Convert graph initializers into OrtValue Phase I by yuslepukhin · Pull Request #23979 · microsoft/onnxruntime

github-advanced-security[bot]

bot found potential problems Mar 10, 2025

github-actions[bot]

@yuslepukhin yuslepukhin changed the title [DRAFT do not review] Convert graph initializers into OrtValue [DRAFT] Convert graph initializers into OrtValue

Apr 28, 2025

@yuslepukhin yuslepukhin changed the title [DRAFT] Convert graph initializers into OrtValue [DRAFT] Convert graph initializers into OrtValue Phase I

Apr 28, 2025

yuslepukhin

yuslepukhin

@yuslepukhin yuslepukhin changed the title [DRAFT] Convert graph initializers into OrtValue Phase I Convert graph initializers into OrtValue Phase I

May 7, 2025

@yuslepukhin

@yuslepukhin

snnn

skottmckay

@Honry Honry mentioned this pull request

Jun 16, 2025

adrianlizarraga added a commit that referenced this pull request

Jun 26, 2025
#25159)

### Description
Updates the `OrtGraph` implementation to take advantage of the work done
in PR #23979, which sets
the infrastructure to store initializers as `OrtValue` instances in the
`onnxruntime::Graph`.

There still needs to be second part to the [aforementioned
PR](#23979) to ensure that
all initializers are stored as `OrtValue`s in the Graph.



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

adrianlizarraga pushed a commit that referenced this pull request

Jul 23, 2025
### Description

Make protobuf weights refer to OrtValues on load.
Create OrtValues for initializers that are loaded from ORT format for
uniformity.
Create OrtValues for ORT format initializers.
Adjust exporting Graph::ToGraphProto() so it does not export in memory
references in external data.
Make CoreML process external data including in memory references so it
can copy it.

### Motivation and Context
Follow up for #23979

wcy123 pushed a commit to wcy123/onnxruntime that referenced this pull request

Aug 1, 2025

This was referenced

Aug 1, 2025

carzh pushed a commit that referenced this pull request

Aug 7, 2025
### Description

Make protobuf weights refer to OrtValues on load.
Create OrtValues for initializers that are loaded from ORT format for
uniformity.
Create OrtValues for ORT format initializers.
Adjust exporting Graph::ToGraphProto() so it does not export in memory
references in external data.
Make CoreML process external data including in memory references so it
can copy it.

### Motivation and Context
Follow up for #23979

adrianlizarraga pushed a commit that referenced this pull request

Aug 8, 2025
### Description

It is related to #25320 #23979. Enable tensor raw data sharing for
externalized tensor proto with kTensorProtoMemoryAddressTag

### Motivation and Context

With #25320 #23979, all initialized tensor protos are associated with
OrtValue, VitisiAI EP need to adapt to this change.

Co-authored-by: mingyue <mingyue@amd.com>

adrianlizarraga pushed a commit that referenced this pull request

Aug 9, 2025
### Description

It is related to #25320 #23979. Enable tensor raw data sharing for
externalized tensor proto with kTensorProtoMemoryAddressTag

### Motivation and Context

With #25320 #23979, all initialized tensor protos are associated with
OrtValue, VitisiAI EP need to adapt to this change.

Co-authored-by: mingyue <mingyue@amd.com>

sanketkaleoss pushed a commit to sanketkaleoss/onnxruntime that referenced this pull request

Aug 11, 2025
### Description

Make protobuf weights refer to OrtValues on load.
Create OrtValues for initializers that are loaded from ORT format for
uniformity.
Create OrtValues for ORT format initializers.
Adjust exporting Graph::ToGraphProto() so it does not export in memory
references in external data.
Make CoreML process external data including in memory references so it
can copy it.

### Motivation and Context
Follow up for microsoft#23979

sanketkaleoss pushed a commit to sanketkaleoss/onnxruntime that referenced this pull request

Aug 11, 2025
### Description

It is related to microsoft#25320 microsoft#23979. Enable tensor raw data sharing for
externalized tensor proto with kTensorProtoMemoryAddressTag

### Motivation and Context

With microsoft#25320 microsoft#23979, all initialized tensor protos are associated with
OrtValue, VitisiAI EP need to adapt to this change.

Co-authored-by: mingyue <mingyue@amd.com>

gedoensmax pushed a commit to gedoensmax/onnxruntime that referenced this pull request

Sep 2, 2025
### Description

It is related to microsoft#25320 microsoft#23979. Enable tensor raw data sharing for
externalized tensor proto with kTensorProtoMemoryAddressTag

### Motivation and Context

With microsoft#25320 microsoft#23979, all initialized tensor protos are associated with
OrtValue, VitisiAI EP need to adapt to this change.

Co-authored-by: mingyue <mingyue@amd.com>

yuslepukhin added a commit that referenced this pull request

Oct 30, 2025

quic-ankus pushed a commit to CodeLinaro/onnxruntime that referenced this pull request

Nov 25, 2025
### Description
This PR converts TensorProto graph initializers to TensorProto/OrtValue
pairs.
Currently, we only split the output for some optimizers to the above
pairs.
Eventually, we should be able to convert all initializers to OrtValues
on load.
Small weights will continue to be an exception as they are sometimes
required by ONNX inference functions.
Some graph API leaks to EPs so we are not able to remove it at present,
and this constrains our ability to convert everything at once.

### Motivation and Context
Lay Gound for proper layers separation. Eventually eliminate weights
copies in the EPs.

quic-ankus pushed a commit to CodeLinaro/onnxruntime that referenced this pull request

Nov 25, 2025
microsoft#25159)

### Description
Updates the `OrtGraph` implementation to take advantage of the work done
in PR microsoft#23979, which sets
the infrastructure to store initializers as `OrtValue` instances in the
`onnxruntime::Graph`.

There still needs to be second part to the [aforementioned
PR](microsoft#23979) to ensure that
all initializers are stored as `OrtValue`s in the Graph.



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

qti-jkilpatrick pushed a commit to onnxruntime/onnxruntime-qnn that referenced this pull request

Jan 26, 2026
…h (#25159)

### Description
Updates the `OrtGraph` implementation to take advantage of the work done
in PR microsoft/onnxruntime#23979, which sets
the infrastructure to store initializers as `OrtValue` instances in the
`onnxruntime::Graph`.

There still needs to be second part to the [aforementioned
PR](microsoft/onnxruntime#23979) to ensure that
all initializers are stored as `OrtValue`s in the Graph.



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->