Skip to content

Commit a198fde

Browse files
authored
Fix Triton build using icx on Windows (#5224)
# Fix mirror bugs in compilation 1. ```partitions.getPartition((int)0)``` `getPartition` function has two type parameters(`unsigned` and `Operation *`) There are no candidates for `int`. 2. ```constexpr int64_t SRC_MASK = (1ULL << (SrcBits - 1)) - 1;``` On Windows/MSVC, long is 32-bit (LLP64). When `SrcBits == 32`, this becomes `1L << 31`. Left-shifting a signed 32-bit long into the sign bit is **undefined behavior**. MSVC treats this as non–constant at compile time, causing: `constexpr variable must be initialized by a constant expression` Use an unsigned 64-bit base for bit shifts (and make masks unsigned), so the expression is well-defined and remains a constant expression across compilers
1 parent 4fc492c commit a198fde

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Dialect/TritonGPU/Transforms/WarpSpecialization/PartitionLoops.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ LogicalResult triton::gpu::partitionLoop(scf::ForOp loop) {
410410
return success();
411411

412412
auto numPartitions = partitions.getNumPartitions();
413-
auto defaultPartition = partitions.getPartition((int)0);
413+
auto defaultPartition = partitions.getPartition((unsigned int)0);
414414
auto loopVarCategories = classifyLoopVars(loop, defaultPartition, partitions);
415415
auto [loopVarIndices, newResultIndices] =
416416
getLoopVarIndicesToKeep(loop, defaultPartition, loopVarCategories);

third_party/intel/lib/TritonIntelGPUToLLVM/ElementwiseOpToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static SmallVector<Value> Fp_to_Fp8_RTNE(Location loc,
458458
(std::is_same_v<SrcTy, BFloat16Type>));
459459
static_assert((std::is_same_v<DstTy, Float8E4M3Type>) ||
460460
(std::is_same_v<DstTy, Float8E5M2Type>));
461-
constexpr int64_t SRC_MASK = (1L << (SrcBits - 1)) - 1;
461+
constexpr int64_t SRC_MASK = (1ULL << (SrcBits - 1)) - 1;
462462
constexpr int64_t SRC_MMASK = (1L << SrcMBits) - 1;
463463
constexpr int64_t DST_NAN = 0x7F;
464464
constexpr int64_t DST_MAX =

0 commit comments

Comments
 (0)