Skip to content
Merged
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
11 changes: 6 additions & 5 deletions .github/actions/build-llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ runs:
-DCMAKE_INSTALL_PREFIX="${{ env.llvm_install_dir }}"
-DCMAKE_LINKER=lld
-DLLVM_BUILD_UTILS=ON
-DBUILD_SHARED_LIBS=ON
-DLLVM_BUILD_SHARED_LIBS=ON
-DLLVM_BUILD_TOOLS=ON
-DLLVM_BUILD_SHARED_LIBS=ON
-DBUILD_SHARED_LIBS=ON
-DLLVM_ENABLE_ASSERTIONS=ON
-DMLIR_ENABLE_BINDINGS_PYTHON=OFF
-DLLVM_ENABLE_PROJECTS="mlir;lld"
-DLLVM_ENABLE_PROJECTS="mlir;llvm;lld;clang"
-DLLVM_ENABLE_ZSTD=OFF
-DLLVM_INSTALL_UTILS=ON
-DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU"
-DLLVM_ENABLE_TERMINFO=OFF
-DLLVM_ENABLE_ZSTD=OFF
-DLLVM_USE_HOST_TOOLS=ON
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
llvm-project/llvm

ninja -C llvm-project/build check-mlir install
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ 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})

Expand Down
23 changes: 16 additions & 7 deletions ci/download-artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,19 @@ def download_artifact(repository, artifact_name):
return artifact_file


def filter_data_no_symlinks(tarinfo, path):
"""Apply 'data' filter behavior but skip symlinks."""
# Skip symlinks.
def is_contained_path(path):
"""Check if a path is contained (i.e., does not contain '..' or start with '/')."""
return not (path.startswith('/') or '..' in path)


def filter_data(tarinfo, path):
"""Apply 'data' filter behavior but skip certain symlinks."""
# Skip symlinks if they point outside the extraction directory.
if tarinfo.issym() or tarinfo.islnk():
return None
if not is_contained_path(tarinfo.linkname):
logging.warning(
f"Skipping symlink: {tarinfo.name} -> {tarinfo.linkname}")
return None

# Apply 'data' filter behavior: strip dangerous metadata, but preserve
# executability for files that were executable in the archive.
Expand All @@ -99,8 +107,9 @@ def filter_data_no_symlinks(tarinfo, path):
tarinfo.uid = tarinfo.gid = 0
tarinfo.uname = tarinfo.gname = ""

# Block absolute paths and paths with '..'.
if tarinfo.name.startswith('/') or '..' in tarinfo.name:
# Block paths outside the extraction directory.
if not is_contained_path(tarinfo.name):
logging.warning(f"Skipping potentially unsafe path: {tarinfo.name}")
return None

return tarinfo
Expand All @@ -116,7 +125,7 @@ def extract_artifact(artifact_file):
logging.debug(f"Extracting artifact: {artifact_file}")
try:
with tarfile.open(artifact_file, "r:gz") as tar:
tar.extractall(filter=filter_data_no_symlinks)
tar.extractall(filter=filter_data)
except Exception as e:
logging.error(f"Error extracting artifact: {e}")
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion ci/triton-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
443f4fe96e1073cde55a2fd18fd344f1035a20dc
c60fd50377344ebce1f3102cf14211189b69184f
7 changes: 7 additions & 0 deletions support/python/src/ir.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This is a forward declaration to avoid a build error introduced in
// https://github.com/triton-lang/triton/pull/9626. The problem is that
// `PluginUtils.h` depends on this class in `python/src/ir.h` for the builder
// necessary to add custom operations. Including this file temporarily resolves
// the missing header; when that is fixed upstream (e.g.,
// https://github.com/triton-lang/triton/pull/9847), this file can be removed.
class TritonOpBuilder;
Loading