Repository navigation
[GPU] Thread through a common target description - #17217
Conversation
This commit cleans up some header includes and build dependencies: * Created a new target for VectorLayoutAnalysis * Dropped Codegen/Common and Codegen/Utils dependencies from IREEGPU dialect * Removed various header includes not directly used This is a preliminary step for plumbing through a target description, to be defined in the IREEGPU dialect, for various GPU backends.
This reverts commit 9cab5d0.
This commit starts threading through a common target description for various GPU backends. The goal is to unify how we specify the target across CUDA, HIP, Vulkan, and others, so that we can be consistent and reuse the some facilities. Concretely, we introduce a `#iree_gpu.target` attribute in the `IREEGPUDialect` to describe the GPU target. It includes a few fields: * The target GPU API, e.g., cuda, hip, vulkan * The canonical target architecture for compilation, e.g., sm_80 for cuda, gfx942 for hip * A TargetCoreAttr describing the GPU features and limits in a single GPU core (that is, AMD compute unit or NVIDIA streaming multiprocessor), e.g., compute/storage capabilities, subgroup sizes, and workgroup size limits * An optional TargetChipAttr describing GPU features for the final chip or product, e.g., core count To help writing tests, we also introduce another shorthand `#iree_gpu.abbr_target` attribute which contains two fields--the target API and the target arch/chip/product. The target arch/chip/product must be known to the compiler. In order to support common development targets and the shorthand attribute, we list some common AMD/NVIDIA GPU architectures and their capabilities and limits. This is in general fine for datacenter GPU use cases where we only ever care one architecture. This starts with update both LLVMGPU backends (CUDA and ROCm) to use the new target description. Vulkan side is untouched and the next step to unify.
benvanik
left a comment
There was a problem hiding this comment.
I'm a bit concerned at how rigid this is with the enums - this makes it impossible to reuse the fields in plugins that may add additional information - for example, if a user wanted to experiment out of tree with a different API, a different DotProduct data type, etc they can't without upstreaming the new enum values first. Some of that we could probably fix by turning the enums into proper attribute interfaces (so a user could define their own target API that implemented an interface with whatever you're currently switching on the integer for), but something to keep in mind while designing this stuff: we don't want to end up preventing plugins that interoperate with our lowerings or require lock-step development between the plugins and upstream codebases or nasty patches to inject new enum values.
The enums also have a smell of artificial generality: that you need to know the runtime API is sketchy as it implies there will be common code that will switch on that and make decisions in a way a user cannot control without forking/patching. If common code won't be using the runtime API to switch on then it should be omitted and instead represented by construction: the CUDA target will be constructing all the pipelines and knows it's targeting CUDA, and no common passes it adds to its pipeline should care about the fact that the CUDA target created it and only whatever pass options are specified on it.
|
@benvanik I changed to 1) add an extra dictionary attr to allow better flexibility for out of tree targets, and 2) changed to use a cl option |
|
Oh sorry, I think I caused those conflicts because I had the same problem with the enum definitions. Do you want me to fix them? |
Don't worry. I think I fixed them. :) |
|
ok nice :D |
|
Oh actually new ones.. Let me see. :D |
This commit starts threading through a common target description for various GPU backends. The goal is to unify how we specify the target across CUDA, HIP, Vulkan, and others, so that we can be consistent and reuse the some facilities. Concretely, we introduce a `#iree_gpu.target` attribute in the `IREEGPUDialect` to describe the GPU target. It includes a few fields: * The canonical target architecture for compilation, e.g., sm_80 for cuda, gfx942 for hip * A TargetWgpAttr describing the GPU features and limits in a single GPU workgroup processsor (that is, AMD compute unit or NVIDIA streaming multiprocessor), e.g., compute/storage capabilities, subgroup sizes, and workgroup size limits * An optional TargetChipAttr describing GPU features for the final chip or product, e.g., wgp count To help writing tests, we also introduce another command-line option, `--iree-gpu-test-target` to specify the target. This option will be queried if we cannot find the `#iree_gpu.target` attribute in the wrapping IR. This avoids us to duplicate the full target for each test to be concise and clear. In order to support common development targets and the shorthand attribute, we list some common AMD/NVIDIA GPU architectures and their capabilities and limits. This is in general fine for datacenter GPU use cases where we only ever care one architecture. This starts with update both LLVMGPU backends (CUDA and ROCm) to use the new target description. Vulkan side is untouched and the next step to unify. Progress towards iree-org#16341 ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,test_amd_w7900
This commit starts threading through a common target description for various GPU backends. The goal is to unify how we specify the target across CUDA, HIP, Vulkan, and others, so that we can be consistent and reuse the some facilities. Concretely, we introduce a `#iree_gpu.target` attribute in the `IREEGPUDialect` to describe the GPU target. It includes a few fields: * The canonical target architecture for compilation, e.g., sm_80 for cuda, gfx942 for hip * A TargetWgpAttr describing the GPU features and limits in a single GPU workgroup processsor (that is, AMD compute unit or NVIDIA streaming multiprocessor), e.g., compute/storage capabilities, subgroup sizes, and workgroup size limits * An optional TargetChipAttr describing GPU features for the final chip or product, e.g., wgp count To help writing tests, we also introduce another command-line option, `--iree-gpu-test-target` to specify the target. This option will be queried if we cannot find the `#iree_gpu.target` attribute in the wrapping IR. This avoids us to duplicate the full target for each test to be concise and clear. In order to support common development targets and the shorthand attribute, we list some common AMD/NVIDIA GPU architectures and their capabilities and limits. This is in general fine for datacenter GPU use cases where we only ever care one architecture. This starts with update both LLVMGPU backends (CUDA and ROCm) to use the new target description. Vulkan side is untouched and the next step to unify. Progress towards iree-org#16341 ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,test_amd_w7900
This commit starts threading through a common target description for various GPU backends. The goal is to unify how we specify the target across CUDA, HIP, Vulkan, and others, so that we can be consistent and reuse the some facilities. Concretely, we introduce a `#iree_gpu.target` attribute in the `IREEGPUDialect` to describe the GPU target. It includes a few fields: * The canonical target architecture for compilation, e.g., sm_80 for cuda, gfx942 for hip * A TargetWgpAttr describing the GPU features and limits in a single GPU workgroup processsor (that is, AMD compute unit or NVIDIA streaming multiprocessor), e.g., compute/storage capabilities, subgroup sizes, and workgroup size limits * An optional TargetChipAttr describing GPU features for the final chip or product, e.g., wgp count To help writing tests, we also introduce another command-line option, `--iree-gpu-test-target` to specify the target. This option will be queried if we cannot find the `#iree_gpu.target` attribute in the wrapping IR. This avoids us to duplicate the full target for each test to be concise and clear. In order to support common development targets and the shorthand attribute, we list some common AMD/NVIDIA GPU architectures and their capabilities and limits. This is in general fine for datacenter GPU use cases where we only ever care one architecture. This starts with update both LLVMGPU backends (CUDA and ROCm) to use the new target description. Vulkan side is untouched and the next step to unify. Progress towards iree-org#16341 ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,test_amd_w7900
This commit starts threading through a common target description for various GPU backends. The goal is to unify how we specify the target across CUDA, HIP, Vulkan, and others, so that we can be consistent and reuse the some facilities. Concretely, we introduce a `#iree_gpu.target` attribute in the `IREEGPUDialect` to describe the GPU target. It includes a few fields: * The canonical target architecture for compilation, e.g., sm_80 for cuda, gfx942 for hip * A TargetWgpAttr describing the GPU features and limits in a single GPU workgroup processsor (that is, AMD compute unit or NVIDIA streaming multiprocessor), e.g., compute/storage capabilities, subgroup sizes, and workgroup size limits * An optional TargetChipAttr describing GPU features for the final chip or product, e.g., wgp count To help writing tests, we also introduce another command-line option, `--iree-gpu-test-target` to specify the target. This option will be queried if we cannot find the `#iree_gpu.target` attribute in the wrapping IR. This avoids us to duplicate the full target for each test to be concise and clear. In order to support common development targets and the shorthand attribute, we list some common AMD/NVIDIA GPU architectures and their capabilities and limits. This is in general fine for datacenter GPU use cases where we only ever care one architecture. This starts with update both LLVMGPU backends (CUDA and ROCm) to use the new target description. Vulkan side is untouched and the next step to unify. Progress towards iree-org#16341 ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,test_amd_w7900 Signed-off-by: Lubo Litchev <[email protected]>
This commit starts threading through a common target description
for various GPU backends. The goal is to unify how we specify
the target across CUDA, HIP, Vulkan, and others, so that we can
be consistent and reuse the some facilities.
Concretely, we introduce a
#iree_gpu.targetattribute in theIREEGPUDialectto describe the GPU target. It includes a fewfields:
sm_80 for cuda, gfx942 for hip
single GPU workgroup processsor (that is, AMD compute unit
or NVIDIA streaming multiprocessor), e.g., compute/storage
capabilities, subgroup sizes, and workgroup size limits
final chip or product, e.g., wgp count
To help writing tests, we also introduce another command-line
option,
--iree-gpu-test-targetto specify the target. This optionwill be queried if we cannot find the
#iree_gpu.targetattributein the wrapping IR. This avoids us to duplicate the full target
for each test to be concise and clear.
In order to support common development targets and the shorthand
attribute, we list some common AMD/NVIDIA GPU architectures
and their capabilities and limits. This is in general fine for
datacenter GPU use cases where we only ever care one architecture.
This starts with update both LLVMGPU backends (CUDA and ROCm)
to use the new target description. Vulkan side is untouched and
the next step to unify.
Progress towards #16341
ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,test_amd_w7900