summaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp
AgeCommit message (Collapse)Author
2025-11-19[mlir][LLVM] Resync memory effect attribute with LLVM IR (#168568)darkbuck
- Add missing locations, namely 'ErrnoMem', 'TargetMem0', and 'TargetMem1'.
2025-10-30[mlir] Simplify Default cases in type switches. NFC. (#165767)Jakub Kuderski
Use default values instead of lambdas when possible. `std::nullopt` and `nullptr` can be used now because of https://github.com/llvm/llvm-project/pull/165724.
2025-10-23[MLIR][GPU] Generalize gpu.printf op lowering to LLVM call pattern. (#164297)Sang Ik Lee
Existing pattern for lowering gpu.printf op to LLVM call uses fixed function name and calling convention. Those two should be exposed as pass option to allow supporting Intel Compute Runtime for GPU. Also adds gpu.printf op pattern to GPU to LLVMSPV pass. It may appear out of place, but integration test is added to XeVM integration test as that is the current best folder for testing with Intel Compute Runtime. Test should be moved in the future if a better test folder is added.
2025-07-22[mlir][NFC] update `Conversion` create APIs (5/n) (#149887)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-01-09[MLIR][GPU] Support bf16 and i1 gpu::shuffles to LLVMSPIRV conversion (#119675)Pietro Ghiglio
This PR adds support to the `bf16` and `i1` data types when converting `gpu::shuffle` to the `LLVMSPV` dialect, by inserting `bitcast` to/from `i16` (for `bf16`) and extending/truncating to `i8` (for `i1`).
2024-12-12[MLIR][GPUToLLVMSPV] Update ConvertGpuOpsToLLVMSPVOps's option (#118818)Jefferson Le Quellec
## Description This PR updates the `ConvertGpuOpsToLLVMSPVOps`'s option by replacing the `index-bitwidth` with a boolean option `use-64bit-index` (similar to the `ConvertGPUToSPIRV` option). The reason for this modification is because the `ConvertGpuOpsToLLVMSPVOps`: > Generate LLVM operations to be ingested by a SPIR-V backend for gpu operations In the context of SPIR-V specifications only two physical addressing models are allowed: `Physical32` and `Physical64`. This change guarantees output sanity by preventing invalid or unsupported index bitwidths from being specified.
2024-11-27[MLIR][GPUToLLVMSPV] Use `llvm.func` attributes to convert `gpu.shuffle` ↵Victor Perez
(#116967) Use `llvm.func`'s `intel_reqd_sub_group_size` attribute instead of SPIR-V environment attributes in the `gpu.shuffle` conversion pattern. This metadata is needed to check the semantics of the operation are supported, i.e., it has a constant width and its value is equal to the sub-group size. As the pass also converts `gpu.func` to `llvm.func`, adding a discardable attribute of name `intel_reqd_sub_group_size` attribute to the latter is enough for this pattern to work. We no longer have a notion of "default" sub-group size, so this attribute needs to be set in the parent function for `gpu.shuffle` operations to be converted. Drop dependency on the SPIR-V dialect as we no longer require creating attributes from this dialect to lower `gpu.shuffle` instances. --------- Signed-off-by: Victor Perez <victor.perez@codeplay.com>
2024-10-10[MLIR][GPU-LLVM] Add in-pass signature update for opencl kernels (#105664)Petr Kurapov
Default to Global address space for memrefs that do not have an explicit address space set in the IR. --------- Co-authored-by: Victor Perez <victor.perez@intel.com> Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com> Co-authored-by: Victor Perez <victor.perez@codeplay.com>
2024-10-05[mlir][NFC] Mark type converter in `populate...` functions as `const` (#111250)Matthias Springer
This commit marks the type converter in `populate...` functions as `const`. This is useful for debugging. Patterns already take a `const` type converter. However, some `populate...` functions do not only add new patterns, but also add additional type conversion rules. That makes it difficult to find the place where a type conversion was added in the code base. With this change, all `populate...` functions that only populate pattern now have a `const` type converter. Programmers can then conclude from the function signature that these functions do not register any new type conversion rules. Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a `const` object internally.
2024-09-26[MLIR][GPU] Lower subgroup query ops in gpu-to-llvm-spv (#108839)Finlay
These ops are: * gpu.subgroup_id * gpu.lane_id * gpu.num_subgroups * gpu.subgroup_size --------- Signed-off-by: Finlay Marno <finlay.marno@codeplay.com>
2024-08-20[mlir][gpu] Add extra value types for gpu::ShuffleOp (#104605)Finlay
Expand the accepted types for gpu.shuffle to any integer, float or 1d vector of integers or floats. Also updated the gpu-to-llvm-spv pass to support those types.
2024-08-16[MLIR][GPU-LLVM] Add GPU to LLVM-SPV address space mapping (#102621)Victor Perez
Implement mapping: - `global`: 1 - `workgroup`: 3 - `private`: 0 Add `addressSpaceToStorageClass`, mapping GPU address spaces to SPIR-V storage classes to be able to use SPIR-V's `storageClassToAddressSpace`, mapping SPIR-V storage classes to LLVM address spaces according to our mapping above *by definition*. --------- Signed-off-by: Victor Perez <victor.perez@codeplay.com>
2024-08-09[MLIR][GPU-LLVM] Convert `gpu.func` to `llvm.func` (#101664)Victor Perez
Add support in `-convert-gpu-to-llvm-spv` to convert `gpu.func` to `llvm.func` operations. - `spir_kernel`/`spir_func` calling conventions used for kernels/functions. - `workgroup` attributions encoded as additional `llvm.ptr<3>` arguments. - No attribute used to annotate kernels - `reqd_work_group_size` attribute using to encode `gpu.known_block_size`. - `llvm.mlir.workgroup_attrib_size` used to encode workgroup attribution sizes. This will be attached to the pointer argument workgroup attributions lower to. **Note**: A notable missing feature that will be addressed in a follow-up PR is a `-use-bare-ptr-memref-call-conv` option to replace MemRef arguments with bare pointers to the MemRef element types instead of the current MemRef descriptor approach. --------- Signed-off-by: Victor Perez <victor.perez@codeplay.com>
2024-07-24[mlir] Add optimization attrs for gpu-to-llvmspv function declarations and ↵Finlay
calls (#99301) Adds the attributes nounwind and willreturn to all function declarations. Adds `memory(none)` equivalent to the id/dimension function declarations. The function declaration attributes are copied to the function calls. `nounwind` is legal because there are no exception in SPIR-V. I also do not see any reason why any of these functions would not return when used correctly. I'm confident that the get id/dim functions will have no externally observable memory effects, but think the convergent functions will have effects.
2024-07-09[MLIR] Add the convergent attribute to the barrier and shuffle ops (#97807)Finlay
When lowering from the gpu dialect to the llvm dialect for spirv, the barrier op and shuffle ops need a convergent attribute for correctness.
2024-05-31[MLIR][GPU-LLVM] Define `-convert-gpu-to-llvm-spv` pass (#90972)Victor Perez
Define pass for GPU to LLVM conversion for SPIR-V backend tool ingest. Supported operations: - `gpu.block_id` - `gpu.global_id` - `gpu.block_dim` - `gpu.thread_id` - `gpu.grid_dim` - `gpu.barrier` - `gpu.shuffle` --------- Signed-off-by: Victor Perez <victor.perez@codeplay.com>