From a0b1ad4658f42ad2a20ac268a1f82061d1752079 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 18:32:22 +0000 Subject: [PATCH 1/2] ci: update Triton pin to 27c40284 --- ci/triton-hash.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/triton-hash.txt b/ci/triton-hash.txt index c144f6a..a2788d8 100644 --- a/ci/triton-hash.txt +++ b/ci/triton-hash.txt @@ -1 +1 @@ -ca6bd0c30e49b470772e3d47099d2a86692b83e8 +27c402843d9201afc22bde4df223934373721709 From c37c20254c36a95885b08604c78d9b13b5607c3b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 24 Apr 2026 14:22:31 -0700 Subject: [PATCH 2/2] Remove `python/src/ir.h` This undoes the temporary fix introduced in #52. --- CMakeLists.txt | 3 - support/python/src/ir.h | 121 ---------------------------------------- 2 files changed, 124 deletions(-) delete mode 100644 support/python/src/ir.h diff --git a/CMakeLists.txt b/CMakeLists.txt index bc65d8c..408bcc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,9 +69,6 @@ include(TableGen) # required by AddMLIR include(AddLLVM) include(AddMLIR) -# Temporary workaround for missing header (see `support/python/src/ir.h`). -include_directories(${TRITON_EXT_SUPPORT_DIR}) - # Build common infrastructure files. add_subdirectory(${TRITON_EXT_SUPPORT_DIR}) diff --git a/support/python/src/ir.h b/support/python/src/ir.h deleted file mode 100644 index 3aef5e8..0000000 --- a/support/python/src/ir.h +++ /dev/null @@ -1,121 +0,0 @@ -// Full definition of TritonOpBuilder, needed by PluginUtils.h. -// -// This class lives in triton's python/src/ir.h but is not installed by -// `cmake --install`. We vendor the definition here so that triton-ext -// can build against a Triton *install* directory (as CI does) without -// needing the full source tree. -// -// When upstream ships this header in the install -// (see https://github.com/triton-lang/triton/pull/9847), this file can -// be replaced with a simple #include. - -#pragma once -#include "mlir/IR/Builders.h" -#include "mlir/IR/DialectRegistry.h" -#include -#include -#include -#include - -// A custom op builder that keeps track of the last location -class TritonOpBuilder { -public: - TritonOpBuilder(mlir::MLIRContext *context) { - builder = std::make_unique(context); - lastLoc = std::make_unique(builder->getUnknownLoc()); - } - - mlir::OpBuilder &getBuilder() { return *builder; } - mlir::MLIRContext *getContext() { return builder->getContext(); } - - bool isLineInfoEnabled() { return lineInfoEnabled; } - - void setLastLoc(mlir::Location loc) { - if (lineInfoEnabled) - lastLoc = std::make_unique(loc); - } - - void setLastLoc(const std::string &fileName, int line, int column) { - auto context = builder->getContext(); - setLastLoc(mlir::FileLineColLoc::get(context, fileName, line, column)); - } - - mlir::Location getLastLoc() { - assert(lastLoc); - return *lastLoc; - } - - void setInsertionPointToStart(mlir::Block &block) { - if (!block.empty()) - setLastLoc(block.begin()->getLoc()); - else - setLastLoc(getLocForBlock(&block)); - builder->setInsertionPointToStart(&block); - } - - void setInsertionPointToEnd(mlir::Block &block) { - if (!block.empty()) - setLastLoc(block.back().getLoc()); - else - setLastLoc(getLocForBlock(&block)); - builder->setInsertionPointToEnd(&block); - } - - void setInsertionPointAfter(mlir::Operation &op) { - setLastLoc(op.getLoc()); - builder->setInsertionPointAfter(&op); - } - - void restoreInsertionPoint(mlir::OpBuilder::InsertPoint pt) { - setLastLoc(builder->getUnknownLoc()); - if (pt.isSet()) { - if (pt.getPoint() != pt.getBlock()->end()) - setLastLoc(pt.getPoint()->getLoc()); - else - setLastLoc(getLocForBlock(pt.getBlock())); - } - - builder->restoreInsertionPoint(pt); - } - - template OpTy create(Args &&...args) { - auto loc = getLastLoc(); - return OpTy::create(*builder, loc, std::forward(args)...); - } - - // Overload to create or fold a single result operation. - template - std::enable_if_t(), - mlir::Value> - createOrFold(Args &&...args) { - auto loc = getLastLoc(); - return builder->createOrFold(loc, std::forward(args)...); - } - - // Overload to create or fold a zero result operation. - template - std::enable_if_t(), OpTy> - createOrFold(Args &&...args) { - auto loc = getLastLoc(); - return builder->createOrFold(loc, std::forward(args)...); - } - -private: - std::unique_ptr builder; - std::unique_ptr lastLoc; - bool lineInfoEnabled = [] { - const char *s = std::getenv("TRITON_DISABLE_LINE_INFO"); - if (!s) - return true; - std::string v(s); - std::transform(v.begin(), v.end(), v.begin(), - [](unsigned char c) { return std::tolower(c); }); - return !(v == "on" || v == "true" || v == "1"); - }(); - - mlir::Location getLocForBlock(mlir::Block *block) { - if (auto parentOp = block->getParentOp()) - return parentOp->getLoc(); - return builder->getUnknownLoc(); - } -};