@@ -516,7 +516,7 @@ bool mlirAttributeIsAHardwareConstraintAttr(MlirAttribute attr) {
516516
517517MlirAttribute
518518mlirHardwareConstraintAttrGet (MlirContext mlirCtx, unsigned threadsPerWave,
519- size_t wavesPerBlockSize, unsigned *wavesPerBlock,
519+ size_t wavesPerBlockSize, int32_t *wavesPerBlock,
520520 MlirAttribute mmaType, MlirAttribute vectorShapes,
521521 unsigned maxBitsPerLoad) {
522522 MLIRContext *ctx = unwrap (mlirCtx);
@@ -525,9 +525,14 @@ mlirHardwareConstraintAttrGet(MlirContext mlirCtx, unsigned threadsPerWave,
525525 auto vectorShapesAttr =
526526 llvm::cast_if_present<DictionaryAttr>(unwrap (vectorShapes));
527527
528+ DenseI32ArrayAttr wavesPerBlockAttr;
529+ if (wavesPerBlockSize > 0 )
530+ wavesPerBlockAttr = DenseI32ArrayAttr::get (
531+ ctx, llvm::ArrayRef (wavesPerBlock, wavesPerBlockSize));
532+
528533 return wrap (wave::HardwareConstraintAttr::get (
529- ctx, threadsPerWave, llvm::ArrayRef (wavesPerBlock, wavesPerBlockSize) ,
530- mmaTypeAttr, vectorShapesAttr, maxBitsPerLoad));
534+ ctx, threadsPerWave, wavesPerBlockAttr, mmaTypeAttr, vectorShapesAttr ,
535+ maxBitsPerLoad));
531536}
532537
533538MlirTypeID mlirWHardwareConstraintAttrGetTypeID () {
@@ -539,14 +544,15 @@ unsigned mlirHardwareConstraintAttrGetThreadsPerWave(MlirAttribute attr) {
539544 .getThreadsPerWave ();
540545}
541546intptr_t mlirHardwareConstraintAttrGetNumWavesPerBlock (MlirAttribute attr) {
542- return llvm::cast<wave::HardwareConstraintAttr>( unwrap (attr))
543- .getWavesPerBlock ()
544- .size ();
547+ DenseI32ArrayAttr wpb =
548+ llvm::cast<wave::HardwareConstraintAttr>( unwrap (attr)) .getWavesPerBlock ();
549+ return wpb ? wpb .size () : 0 ;
545550}
546- unsigned mlirHardwareConstraintAttrGetWavesPerBlockElem (MlirAttribute attr,
547- intptr_t i) {
551+ int32_t mlirHardwareConstraintAttrGetWavesPerBlockElem (MlirAttribute attr,
552+ intptr_t i) {
548553 return llvm::cast<wave::HardwareConstraintAttr>(unwrap (attr))
549- .getWavesPerBlock ()[i];
554+ .getWavesPerBlock ()
555+ .asArrayRef ()[i];
550556}
551557MlirAttribute mlirHardwareConstraintAttrGetMmaType (MlirAttribute attr) {
552558 return wrap (
0 commit comments