Skip to content

[GPU] Introduce and plumb through GPUCodegenOptions. - #23290

Merged
hanhanW merged 1 commit into
mainfrom
users/hanhanW/gpu-global-options
Feb 9, 2026
Merged

hanhanW merged 1 commit into
mainfrom
users/hanhanW/gpu-global-options

Conversation

@hanhanW

@hanhanW hanhanW commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

The revision mirrors the CPUCodegenOptions pattern from the LLVMCPU backend. For now, it only expose enablePrefetch to public because it is the only flag used in tests/external/iree-test-suites. Other flags can be exposed base on needs. The remaining flags are supposed to be hidden from CLI helpers, since they are either for testing purpose or experiments.

It also drops =true from tests/external/iree-test-suites/* because it is redundant and we want consistency.

@hanhanW

hanhanW commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

It depends on #23259. It is better to wait @IanWood1 to review the other one, just in case if there are red flags or not. (I don't want to waste reviewers' time.)

@hanhanW
hanhanW requested a review from IanWood1 January 27, 2026 01:00
@krzysz00

Copy link
Copy Markdown
Contributor

Does controlling LLVM's opt optimization level and the LLC optimization level also fall into these options or are they handled separately?

@hanhanW

hanhanW commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

Does controlling LLVM's opt optimization level and the LLC optimization level also fall into these options or are they handled separately?

Coming from CPU's world and the LLVM lowering path, I think we eventually will have at least two optimization flags, one is for MLIR level codegen that IREE is doing, and the other is LLVM opt level for LLVM module. E.g., #19072 (comment)

  // Optimization level to be used by the LLVM optimizer (middle-end).
  llvm::OptimizationLevel optimizerOptLevel;
  // Optimization level to be used by the LLVM code generator (back-end).
  llvm::CodeGenOptLevel codeGenOptLevel;

This one is mainly for MLIR level that we control our optimization in IREE.

@hanhanW
hanhanW force-pushed the users/hanhanW/gpu-global-options branch from 881b34d to 88bcbc5 Compare February 6, 2026 00:57
@hanhanW
hanhanW changed the base branch from users/hanhanW/global-options to main February 6, 2026 00:57
@hanhanW
hanhanW force-pushed the users/hanhanW/gpu-global-options branch 3 times, most recently from ae118cc to de2615d Compare February 6, 2026 01:15
@hanhanW
hanhanW marked this pull request as ready for review February 6, 2026 01:55
@hanhanW
hanhanW force-pushed the users/hanhanW/gpu-global-options branch from de2615d to f8c6b2a Compare February 6, 2026 23:46
The revision mirrors the CPUCodegenOptions pattern from the LLVMCPU backend. For now, it only expose `enablePrefetch` to public because it is the only flag used in `tests/external/iree-test-suites`. Other flags can be exposed base on needs. The remaining flags are supposed to be hidden from CLI helpers, since they are either for testing purpose or experiments.

It also drops `=true` from `tests/external/iree-test-suites/*` because it is redundant and we want consistency.

Signed-off-by: hanhanW <[email protected]>
class ROCMTargetBackend final : public TargetBackend {
public:
ROCMTargetBackend(const ROCMOptions &options) : options(options) {}
ROCMTargetBackend(const ROCMOptions &options, GPUCodegenOptions codegenOpts)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the warning above is actionable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. We should move these classes into an anonymous namespace. There are several classes need the fix (e.g., AMDGPUTargetDevice, HIPTargetDevice, and other backends, etc.), so I'll send a follow-up to fix them.

@hanhanW
hanhanW merged commit 6f2612b into main Feb 9, 2026
61 checks passed
@hanhanW
hanhanW deleted the users/hanhanW/gpu-global-options branch February 9, 2026 19:17
MaheshRavishankar pushed a commit to MaheshRavishankar/iree that referenced this pull request Feb 24, 2026
The revision mirrors the CPUCodegenOptions pattern from the LLVMCPU
backend. For now, it only expose `enablePrefetch` to public because it
is the only flag used in `tests/external/iree-test-suites`. Other flags
can be exposed base on needs. The remaining flags are supposed to be
hidden from CLI helpers, since they are either for testing purpose or
experiments.

It also drops `=true` from `tests/external/iree-test-suites/*` because
it is redundant and we want consistency.

Signed-off-by: hanhanW <[email protected]>
kimm240 pushed a commit to kimm240/iree that referenced this pull request May 8, 2026
The revision mirrors the CPUCodegenOptions pattern from the LLVMCPU
backend. For now, it only expose `enablePrefetch` to public because it
is the only flag used in `tests/external/iree-test-suites`. Other flags
can be exposed base on needs. The remaining flags are supposed to be
hidden from CLI helpers, since they are either for testing purpose or
experiments.

It also drops `=true` from `tests/external/iree-test-suites/*` because
it is redundant and we want consistency.

Signed-off-by: hanhanW <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants