diff --git a/third_party/intel/lib/TritonIntelGPUToLLVM/AllocateSharedMemory.cpp b/third_party/intel/lib/TritonIntelGPUToLLVM/AllocateSharedMemory.cpp index b03c612dd7..1c48ca8da5 100644 --- a/third_party/intel/lib/TritonIntelGPUToLLVM/AllocateSharedMemory.cpp +++ b/third_party/intel/lib/TritonIntelGPUToLLVM/AllocateSharedMemory.cpp @@ -49,9 +49,14 @@ struct AllocateSharedMemory IntegerAttr::get(IntegerType::get(ctx, 32), offset)); }); }); - mod->setAttr("triton_gpu.shared", - IntegerAttr::get(IntegerType::get(ctx, 32), - allocation.getSharedMemorySize())); + int32_t originSharedSize = 0; + if (IntegerAttr sharedAttr = + mod->getAttrOfType("triton_gpu.shared")) + originSharedSize = sharedAttr.getInt(); + mod->setAttr( + "triton_gpu.shared", + IntegerAttr::get(IntegerType::get(ctx, 32), + originSharedSize + allocation.getSharedMemorySize())); } };