Skip to content

Commit

Permalink
Bump llvm to ec17161c6e87bb061daee4603ed21ab988f9d03d (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
erwei-xilinx authored Feb 16, 2025
1 parent 32179a0 commit 98bec8f
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ cmake_dependent_option(AIE_ENABLE_AIRBIN
# If we need runtime libs, then statically link them.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

# add_flag_if_supported("-Werror=sign-compare" WERROR_SIGN_COMPARE)
add_flag_if_supported("-Werror=sign-compare" WERROR_SIGN_COMPARE)
add_flag_if_supported("-Werror=unused" WERROR_USED)

# What happens when you have a non-void function with no return?
Expand Down
1 change: 1 addition & 0 deletions lib/Dialect/XLLVM/XLLVMOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//

#include "aie/Dialect/XLLVM/XLLVMDialect.h"
#include "llvm/IR/IRBuilder.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/TypeUtilities.h"
Expand Down
22 changes: 20 additions & 2 deletions python/compiler/aiecc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,16 @@ def downgrade_ir_for_chess(llvmir_chesslinked):
"inaccessiblemem_or_argmemonly writeonly",
)
.replace("captures(none)", "nocapture")
.replace("getelementptr inbounds nuw", "getelementptr inbounds")
)
return llvmir_chesslinked


def downgrade_ir_for_peano(llvmir):
llvmir = llvmir.replace("getelementptr inbounds nuw", "getelementptr inbounds")
return llvmir


class FlowRunner:
def __init__(self, mlir_module_str, opts, tmpdirname):
self.mlir_module_str = mlir_module_str
Expand Down Expand Up @@ -494,6 +500,16 @@ async def chesshack(self, task, llvmir, aie_target):

return llvmir_chesslinked_path

# In order to run peano on modern ll code, we need a bunch of hacks.
async def peanohack(self, llvmir):
llvmir_peanohack = llvmir + "peanohack.ll"

llvmir_ir = await read_file_async(llvmir)
llvmir_hacked_ir = downgrade_ir_for_peano(llvmir_ir)
await write_file_async(llvmir_hacked_ir, llvmir_peanohack)

return llvmir_peanohack

async def process_core(
self,
core,
Expand Down Expand Up @@ -563,8 +579,9 @@ async def process_core(

elif opts.compile:
if not opts.unified:
file_core_llvmir_peanohacked = await self.peanohack(file_core_llvmir)
file_core_llvmir_stripped = corefile(self.tmpdirname, core, "stripped.ll")
await self.do_call(task, [self.peano_opt_path, "--passes=default<O2>,strip", "-S", file_core_llvmir, "-o", file_core_llvmir_stripped])
await self.do_call(task, [self.peano_opt_path, "--passes=default<O2>,strip", "-S", file_core_llvmir_peanohacked, "-o", file_core_llvmir_stripped])
await self.do_call(task, [self.peano_llc_path, file_core_llvmir_stripped, "-O2", "--march=" + aie_target.lower(), "--function-sections", "--filetype=obj", "-o", file_core_obj])
else:
file_core_obj = self.unified_file_core_obj
Expand Down Expand Up @@ -1154,8 +1171,9 @@ async def run_flow(self):
file_llvmir_hacked = await self.chesshack(progress_bar.task, file_llvmir, aie_target)
await self.do_call(progress_bar.task, ["xchesscc_wrapper", aie_target.lower(), "+w", self.prepend_tmp("work"), "-c", "-d", "+Wclang,-xir", "-f", file_llvmir_hacked, "-o", self.unified_file_core_obj])
elif opts.compile:
file_llvmir_hacked = await self.peanohack(file_llvmir)
file_llvmir_opt = self.prepend_tmp("input.opt.ll")
await self.do_call(progress_bar.task, [self.peano_opt_path, "--passes=default<O2>", "-inline-threshold=10", "-S", file_llvmir, "-o", file_llvmir_opt])
await self.do_call(progress_bar.task, [self.peano_opt_path, "--passes=default<O2>", "-inline-threshold=10", "-S", file_llvmir_hacked, "-o", file_llvmir_opt])
await self.do_call(progress_bar.task, [self.peano_llc_path, file_llvmir_opt, "-O2", "--march=" + aie_target.lower(), "--function-sections", "--filetype=obj", "-o", self.unified_file_core_obj])
# fmt: on

Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ ml_dtypes
matplotlib
notebook
pre-commit
nanobind
nanobind>=2.5
3 changes: 2 additions & 1 deletion python/requirements_extras.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This can't go in the normal requirements file because the way the wheels build parses requirements.txt
# does not support github packages
git+https://github.com/makslevental/mlir-python-extras@8aba4e7
git+https://github.com/makslevental/mlir-python-extras@15cb803
-f https://github.com/llvm/eudsl/releases/expanded_assets/latest
2 changes: 1 addition & 1 deletion test/Integration/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if config.aie_include_integration_tests != 'ON':

tosa_to_linalg = '--pass-pipeline="builtin.module(func.func(tosa-to-linalg-named, tosa-to-linalg, tosa-to-tensor))"'
transform_linalg_for_aievec_cpp = '--dynamic-size-no-implicit-broadcast'
linalg_to_affine = '--linalg-fuse-elementwise-ops --linalg-fold-unit-extent-dims --eliminate-empty-tensors --empty-tensor-to-alloc-tensor --one-shot-bufferize="allow-return-allocs-from-loops allow-unknown-ops bufferize-function-boundaries function-boundary-type-conversion=identity-layout-map unknown-type-conversion=identity-layout-map" --drop-equivalent-buffer-results --buffer-results-to-out-params --buffer-deallocation --canonicalize --cse --convert-linalg-to-affine-loops'
linalg_to_affine = '--linalg-fuse-elementwise-ops --linalg-fold-unit-extent-dims --eliminate-empty-tensors --empty-tensor-to-alloc-tensor --one-shot-bufferize="allow-return-allocs-from-loops allow-unknown-ops bufferize-function-boundaries function-boundary-type-conversion=identity-layout-map unknown-type-conversion=identity-layout-map" --drop-equivalent-buffer-results --buffer-results-to-out-params --buffer-deallocation-pipeline --canonicalize --cse --convert-linalg-to-affine-loops'

config.substitutions.append(('%tosa-to-linalg%', tosa_to_linalg))
config.substitutions.append(('%linalg-to-vector-v64%', transform_linalg_for_aievec_cpp+' '+linalg_to_affine+' --affine-super-vectorize="virtual-vector-size=64"'))
Expand Down
4 changes: 2 additions & 2 deletions test/Targets/AIEVecToCpp/polygeist_conv2d_i32.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// (c) Copyright 2024 Advanced Micro Devices, Inc. or its affiliates
//
//===----------------------------------------------------------------------===//
// RUN: aie-opt --affine-loop-unroll="unroll-full unroll-full-threshold=3" --canonicalize -affine-super-vectorize="virtual-vector-size=8 vectorize-reductions" --aie-vectorize | aie-translate --aievec-to-cpp > %t.cpp
// RUN: aie-opt -pass-pipeline="builtin.module(func.func(affine-loop-unroll{unroll-full=true unroll-full-threshold=3}), canonicalize, func.func(affine-super-vectorize{virtual-vector-size=8 vectorize-reductions}), aie-vectorize)" | aie-translate --aievec-to-cpp > %t.cpp

module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.endianness", "little">, #dlti.dl_entry<i64, dense<64> : vector<2xi32>>, #dlti.dl_entry<f80, dense<128> : vector<2xi32>>, #dlti.dl_entry<i1, dense<8> : vector<2xi32>>, #dlti.dl_entry<i8, dense<8> : vector<2xi32>>, #dlti.dl_entry<i16, dense<16> : vector<2xi32>>, #dlti.dl_entry<i32, dense<32> : vector<2xi32>>, #dlti.dl_entry<f16, dense<16> : vector<2xi32>>, #dlti.dl_entry<f64, dense<64> : vector<2xi32>>, #dlti.dl_entry<f128, dense<128> : vector<2xi32>>>, llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu"} {
func.func @conv2d(%arg0: memref<?x272xi32>, %arg1: memref<?x3xi32>, %arg2: memref<?x256xi32>) attributes {llvm.linkage = #llvm.linkage<external>} {
Expand All @@ -29,4 +29,4 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.endianness"
}
return
}
}
}
4 changes: 2 additions & 2 deletions test/dialect/AIEVec/precanonicalization-aieml-llvmir.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func.func @scalar_extsi_to_broadcast_swap(%s: i8) -> vector<32xi32> {
// CHECK-LABEL: @extsi_to_broadcast_swap(
// CHECK-SAME: %[[VIN:.*]]: vector<8xi8>
func.func @extsi_to_broadcast_swap(%v: vector<8xi8>) -> vector<4x8xi32> {
// CHECK: %[[ZV:.*]] = arith.constant dense<0> : vector<4x8xi8>
// CHECK: %[[ZV:.*]] = ub.poison : vector<4x8xi8>
// CHECK: %[[I0:.*]] = vector.insert %[[VIN]], %[[ZV]] [0] : vector<8xi8> into vector<4x8xi8>
// CHECK: %[[I1:.*]] = vector.insert %[[VIN]], %[[I0]] [1] : vector<8xi8> into vector<4x8xi8>
// CHECK: %[[I2:.*]] = vector.insert %[[VIN]], %[[I1]] [2] : vector<8xi8> into vector<4x8xi8>
Expand All @@ -31,7 +31,7 @@ func.func @extsi_to_broadcast_swap(%v: vector<8xi8>) -> vector<4x8xi32> {
// CHECK-LABEL: @broadcast_to_insert(
// CHECK-SAME: %[[V:.*]]: vector<8xbf16>
func.func @broadcast_to_insert(%v: vector<8xbf16>) -> vector<1x4x8xbf16> {
// CHECK: %[[ZV:.*]] = arith.constant dense<0.000000e+00> : vector<4x8xbf16>
// CHECK: %[[ZV:.*]] = ub.poison : vector<4x8xbf16>
// CHECK: %[[I0:.*]] = vector.insert %[[V]], %[[ZV]] [0] : vector<8xbf16> into vector<4x8xbf16>
// CHECK: %[[I1:.*]] = vector.insert %[[V]], %[[I0]] [1] : vector<8xbf16> into vector<4x8xbf16>
// CHECK: %[[I2:.*]] = vector.insert %[[V]], %[[I1]] [2] : vector<8xbf16> into vector<4x8xbf16>
Expand Down
2 changes: 1 addition & 1 deletion test/python/aievec.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def dut(A: T.tensor(1024, T.i8()), B: T.tensor(1024, T.i8())):
)
.drop_equivalent_buffer_results()
.buffer_results_to_out_params()
.Func(p().buffer_deallocation())
.add_pass("buffer-deallocation-pipeline")
.canonicalize()
.cse()
.convert_linalg_to_affine_loops()
Expand Down
4 changes: 2 additions & 2 deletions utils/clone-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
##===----------------------------------------------------------------------===##

# The LLVM commit to use.
LLVM_PROJECT_COMMIT=e6d16f93b329f2f9618d18d0b99c6060e206cf08
DATETIME=2025013107
LLVM_PROJECT_COMMIT=ec17161c6e87bb061daee4603ed21ab988f9d03d
DATETIME=2025021418
WHEEL_VERSION=21.0.0.$DATETIME+${LLVM_PROJECT_COMMIT:0:8}

############################################################################################
Expand Down
2 changes: 1 addition & 1 deletion utils/mlir_aie_wheels/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pybind11[global]>=2.10.4
rich
setuptools>=42
wheel
nanobind>=2.4
nanobind>=2.5

0 comments on commit 98bec8f

Please sign in to comment.