Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using extended minimal build for several EPs #23834

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Feb 27, 2025

Description

Background

From code search, the following EPs use onnxruntime::GetCpuPreferredNodes() in their GetCapabilities() methods:

  • CANN
  • CUDA
  • DML
  • JS
  • ROCM
  • WebGPU

However, the source file that implements onnxruntime::GetCpuPreferredNodes() is excluded when minimal build is ON:

if (onnxruntime_MINIMAL_BUILD)
set(onnxruntime_framework_src_exclude
"${ONNXRUNTIME_ROOT}/core/framework/fallback_cpu_capability.h"
"${ONNXRUNTIME_ROOT}/core/framework/fallback_cpu_capability.cc"
)

This means that all EPs mentioned above is not able to compile with minimal build.

Solution

The excluded file core/framework/fallback_cpu_capability.cc cannot build in minimal build because some of its dependencies are not included in the minimal build. However, in extended minimal build mode, all dependencies are available.

This PR looses the restrict and allows to compile this file when it is extended minimal build. After this change, those EPs are able to compile in extended minimal build.

@FricoRico
Copy link

Confirmed this fixes building on for Android using --minimal_build

@grazder
Copy link

grazder commented Feb 28, 2025

I tried too with --use_jsep, everything works

@fs-eire fs-eire changed the title Allow using extended minimal build for multiple EPs Allow using extended minimal build for several EPs Mar 4, 2025
@fs-eire fs-eire merged commit 17dcea7 into main Mar 4, 2025
95 checks passed
@fs-eire fs-eire deleted the fs-eire/allow-minimal-build-extended branch March 4, 2025 18:06
amarin16 pushed a commit that referenced this pull request Mar 5, 2025
### Description

#### Background

From code search, the following EPs use
`onnxruntime::GetCpuPreferredNodes()` in their `GetCapabilities()`
methods:
- CANN
- CUDA
- DML
- JS
- ROCM
- WebGPU

However, the source file that implements
`onnxruntime::GetCpuPreferredNodes()` is excluded when minimal build is
ON:
https://github.com/microsoft/onnxruntime/blob/6df0973e58ba5399fcaa98686f70ed9a9e59aaef/cmake/onnxruntime_framework.cmake#L38-L42

This means that all EPs mentioned above is not able to compile with
minimal build.

#### Solution

The excluded file `core/framework/fallback_cpu_capability.cc` cannot
build in minimal build because some of its dependencies are not included
in the minimal build. However, in extended minimal build mode, all
dependencies are available.

This PR looses the restrict and allows to compile this file when it is
extended minimal build. After this change, those EPs are able to compile
in extended minimal build.
guschmue pushed a commit that referenced this pull request Mar 6, 2025
### Description

#### Background

From code search, the following EPs use
`onnxruntime::GetCpuPreferredNodes()` in their `GetCapabilities()`
methods:
- CANN
- CUDA
- DML
- JS
- ROCM
- WebGPU

However, the source file that implements
`onnxruntime::GetCpuPreferredNodes()` is excluded when minimal build is
ON:
https://github.com/microsoft/onnxruntime/blob/6df0973e58ba5399fcaa98686f70ed9a9e59aaef/cmake/onnxruntime_framework.cmake#L38-L42

This means that all EPs mentioned above is not able to compile with
minimal build.

#### Solution

The excluded file `core/framework/fallback_cpu_capability.cc` cannot
build in minimal build because some of its dependencies are not included
in the minimal build. However, in extended minimal build mode, all
dependencies are available.

This PR looses the restrict and allows to compile this file when it is
extended minimal build. After this change, those EPs are able to compile
in extended minimal build.
amarin16 added a commit that referenced this pull request Mar 6, 2025
The second round of cherry-picks into
[rel-1.21.0](https://github.com/microsoft/onnxruntime/tree/rel-1.21.0).
The first one was done in
#23846.
- #23779
- #23856
- #23827
- #23834
- #23876
- #23892

---------

Co-authored-by: Jambay Kinley <jambaykinley@microsoft.com>
Co-authored-by: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
Co-authored-by: Ashish Garg <quic_ashigarg@quicinc.com>
Co-authored-by: Ashish Garg <ashigarg@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants