Skip to content

[EXPERIMENTAL]: Load column major matrix with 2d block io #4604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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: 4 additions & 0 deletions include/triton/Tools/Sys/GetEnv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ inline const std::set<std::string> CACHE_INVALIDATING_ENV_VARS = {
"TRITON_INTEL_ENABLE_INSTR_SCHED",
"TRITON_INTEL_FAST_MATH",
"TRITON_INTEL_REDUCE_TRANSPOSE",
"TRITON_INTEL_ENABLE_SIMD_REDUCE",
"TRITON_INTEL_ENHANCED_ACCELERATION_MATMUL",
"TRITON_INTEL_ENABLE_DPAS_WARP_SIZE_32",
"TRITONGEN_FORCE_GENISA",
// clang-format on
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def TritonGEN_PrecisionTypeAttr : I32EnumAttr<"PrecisionType",
I32EnumAttrCase<"S4", 5, "i4">,
I32EnumAttrCase<"S2", 6, "i2">,
I32EnumAttrCase<"BF8", 7, "bf8">,
I32EnumAttrCase<"TF32", 8, "tf32">,
I32EnumAttrCase<"BF16", 9, "bf16">,
I32EnumAttrCase<"FP16", 10, "f16">
I32EnumAttrCase<"TF32", 10, "tf32">,
I32EnumAttrCase<"BF16", 11, "bf16">,
I32EnumAttrCase<"FP16", 12, "f16">
]> {
let cppNamespace = "::mlir::triton::TritonGEN";
}
Expand Down
15 changes: 12 additions & 3 deletions third_party/intel/lib/Dialect/TritonGEN/IR/TritonGENOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ LogicalResult TritonGEN::MatrixDPASOp::verify() {
return this->emitOpError(
"1st operand (C) and result (D) should have the same type");

if (CTy.getNumElements() != getRc() || DTy.getNumElements() != getRc())
auto useGenISA = tools::getBoolEnv("TRITONGEN_FORCE_GENISA");

if (!useGenISA &&
(CTy.getNumElements() != getRc() || DTy.getNumElements() != getRc()))
return this->emitOpError("the dimension for 1st operand (C) and "
"result (D) should match repeat count");

constexpr unsigned SD = 8;
if (BTy.getNumElements() != SD)
if (!useGenISA && BTy.getNumElements() != SD)
return this->emitOpError("the dimension for the 3rd operand (B) should "
"match the systolic depth of 8");

Expand Down Expand Up @@ -141,7 +144,7 @@ LogicalResult TritonGEN::MatrixDPASOp::verify() {
case TritonGEN::PrecisionType::FP16:
case TritonGEN::PrecisionType::U8:
case TritonGEN::PrecisionType::S8:
if (ATy.getNumElements() != getRc())
if (!useGenISA && ATy.getNumElements() != getRc())
return this->emitOpError("2nd operand (A) should have the same number of "
"elements as repeat count");
if (!AElemTy.isInteger(16))
Expand Down Expand Up @@ -303,6 +306,9 @@ LogicalResult TritonGEN::Matrix2DBlockLoadOp::verify() {
if (verify2DBlockLoadHWRestriction(*this).failed())
return failure();

if (tools::getBoolEnv("TRITONGEN_FORCE_GENISA"))
return success();

if (verifyMatrixInput(*this).failed())
return failure();

Expand Down Expand Up @@ -367,6 +373,9 @@ LogicalResult TritonGEN::Matrix2DBlockStoreOp::verify() {
if (verify2DBlockStoreHWRestriction(*this).failed())
return failure();

if (tools::getBoolEnv("TRITONGEN_FORCE_GENISA"))
return success();

if (verifyMatrixInput(*this).failed())
return failure();

Expand Down
9 changes: 9 additions & 0 deletions third_party/intel/lib/TritonGENToLLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
add_library(GenISAIntrinsics STATIC IMPORTED GLOBAL)
set_target_properties(GenISAIntrinsics
PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libGenISAIntrinsics.a
)

add_triton_library(TritonGENToLLVM
Attributes.cpp
TritonGENToLLVMPass.cpp
GenIntrinsicHelper.cpp

DEPENDS
TritonGENToLLVMConversionPassIncGen
GenISAIntrinsics

LINK_LIBS PUBLIC
GenISAIntrinsics
MLIRLLVMDialect
MLIRSPIRVDialect
TritonIntelUtils
MLIRTargetLLVMIRImport
)
Loading
Loading