Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ struct OpLowering : public ConvertOpToLLVMPattern<Op> {

if (upperBound && intrType != IntrType::None) {
int32_t min = (intrType == IntrType::Dim ? 1 : 0);
int32_t max = *upperBound + (intrType == IntrType::Id ? 0 : 1);
int32_t max = *upperBound == INT_MAX
? *upperBound
: *upperBound + (intrType == IntrType::Id ? 0 : 1);
newOp->setAttr("range", LLVM::ConstantRangeAttr::get(
rewriter.getContext(), 32, min, max));
}
Expand Down
13 changes: 13 additions & 0 deletions mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,16 @@ gpu.module @test_module {
gpu.module @test_custom_data_layout attributes {llvm.data_layout = "e"} {

}

// -----

gpu.module @test_module {
// CHECK32-LABEL: func @gpu_dim_int_max_upper_bound()
func.func @gpu_dim_int_max_upper_bound()
-> (index) {

// CHECK32: rocdl.workgroup.dim.x range <i32, 1, 2147483647> : i32
%bDimX = gpu.block_dim x upper_bound 2147483647
func.return %bDimX : index
}
}
Loading