Skip to content

[compiler] Make cuda/hip/vulkan target cl options consistent - #17710

Merged
antiagainst merged 14 commits into
iree-org:mainfrom
antiagainst:cl-gpu-targets
Aug 22, 2024
Merged

antiagainst merged 14 commits into
iree-org:mainfrom
antiagainst:cl-gpu-targets

Conversation

@antiagainst

@antiagainst antiagainst commented Jun 20, 2024 •

Copy link
Copy Markdown
Member

This commits changes the command line options for specifying
targets for CUDA/HIP/Vulkan to --iree-<api>-target and the
corresponding feature option to --iree-<api>-target-features.
This makes more sense given we are not using a triple or
a chip anymore--it's more flexible as to accept codenames and
product names. This also makes the options consistent.

This is a breaking change. Here are the main list of options:

Before After
--iree-hal-cuda-llvm-target-arch --iree-cuda-target
--iree-hal-cuda-llvm-target-feature --iree-cuda-target-features
--iree-rocm-target-chip --iree-hip-target
--iree-rocm-target-features --iree-hip-target-features
--iree-vulkan-target-triple --iree-vulkan-target
--iree-hal-cuda-* --iree-cuda-*
--iree-rocm-* --iree-hip-*

Progress towards #16341

ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,build_test_all_macos_arm64,build_and_test_android

@antiagainst antiagainst added hal/vulkan Runtime Vulkan GPU HAL backend hal/cuda Runtime CUDA HAL backend hal/hip Runtime HIP HAL backend labels Jun 20, 2024
@antiagainst
antiagainst force-pushed the cl-gpu-targets branch 2 times, most recently from dcfc0a6 to 100d9d8 Compare June 20, 2024 05:01
@antiagainst antiagainst changed the title [hal] Make cuda/hip/vulkan target cl options consistent [compiler] Make cuda/hip/vulkan target cl options consistent Jun 20, 2024
@antiagainst
antiagainst force-pushed the cl-gpu-targets branch 2 times, most recently from 6c3d7a7 to f8912b0 Compare June 23, 2024 18:51
@antiagainst
antiagainst marked this pull request as ready for review July 29, 2024 14:45

@ScottTodd ScottTodd left a comment

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.

Can you add a table to the PR description with the before --> after for each flag? That would both help with review and for future users looking through commit history to see what changed.

llvm::cl::desc("Dump ptx to the debug stream."));

binder.opt<std::string>("iree-hal-cuda-llvm-target-arch", clTargetChip,
binder.opt<std::string>("iree-cuda-target", clTarget,

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.

I'm not sure about the namespace here.

Some options to consider:

  • iree-hal-cuda- namespace under hal since these relate to the hal part of the pipeline
  • iree-plugin-cuda- namespace under plugin since this code is in a plugin
  • iree-cuda- floating near the top of the namespace hierarchy

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I treat these namespaces as mostly a way to avoid command-line option collison; not to indicate strong nested logical/directory structure. Reason being that from a developer's perspective, it does not matter much to know that, oh, cuda/hip/vulkan is a plugin under hal, which is more implementation details.

Also given these APIs are top tier we are supporting, it's okay to directly use -iree-<api> as a prefix imo--it's shorter and easier to memorize. The iree-hal category can leave for things common to all hal impls (if we ever have).

we sort of doing this structure on codegen side, where iree-codegen prefix is for stuff common to all codegen backends, while iree-spirv, iree-llvmgpu, etc. for backend specific ones. wdyt?

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.

Using --iree-<api>-* instead of --iree-hal-<api>-* sounds good to me. @benvanik might have an opinion too.

llvm::cl::desc("Dump ptx to the debug stream."));

binder.opt<std::string>("iree-hal-cuda-llvm-target-arch", clTargetChip,
binder.opt<std::string>("iree-cuda-target", clTarget,

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.

This is a breaking change.

We could keep the old flags as deprecated to give some time to transition. If the functionality is the same, just forward the old values into the new flags.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm leaning towards to just force the break immedidately. It's gonna happen anyway and people typically don't change until stuff break. :)

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.

Let's be careful with the sequencing and not just break compatibility because we can.

@benvanik has some breaking changes pending too, so we should at least try to batch those together as part of a stable release.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SG. I'm happy to wait until the next train of breaking changes is ready. :D

Signed-off-by: Lei Zhang <[email protected]>
Signed-off-by: Lei Zhang <[email protected]>
@antiagainst

Copy link
Copy Markdown
Member Author

Can you add a table to the PR description with the before --> after for each flag? That would both help with review and for future users looking through commit history to see what changed.

Yup. Done.

@antiagainst
antiagainst requested a review from ScottTodd August 18, 2024 23:37

@ScottTodd ScottTodd left a comment

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.

Okay, changes LGTM. May want at least one other reviewer to look over the flag name changes and approve too.

Timing-wise, we should figure out some process for batching breaking changes together. We've already had one land since the last stable update, so there might not be that much practical value in waiting.

@raikonenfnu raikonenfnu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Thanks for the clean up :)

@antiagainst
antiagainst merged commit c44d29b into iree-org:main Aug 22, 2024
@antiagainst
antiagainst deleted the cl-gpu-targets branch August 22, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/cuda Runtime CUDA HAL backend hal/hip Runtime HIP HAL backend hal/vulkan Runtime Vulkan GPU HAL backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants