Skip to content

Commit 5ff167e

Browse files
authored
Fix tpu (#1054)
* Fix tpu * remove llvm operator on tpu * fix * fix
1 parent f3e0d0f commit 5ff167e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Compiler.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,13 +1189,22 @@ function compile_mlir!(
11891189
# Add a `donated` attr to the function arguments. This doesn't affect XLA, but lets us
11901190
# check which arguments were donated.
11911191
preserved_args_idx = last.(preserved_args)
1192+
if backend != "tpu"
11921193
for (i, arg) in enumerate(linear_args)
11931194
if i preserved_args_idx
11941195
MLIR.API.mlirFuncSetArgAttr(
11951196
func3, i - 1, "reactant.donated", MLIR.IR.UnitAttribute()
11961197
)
11971198
end
11981199
end
1200+
else
1201+
for op in collect(MLIR.IR.OperationIterator(MLIR.IR.body(mod)))
1202+
if MLIR.IR.dialect(op) == :llvm
1203+
MLIR.API.mlirOperationDestroy(op.operation)
1204+
op.operation = MLIR.API.MlirOperation(C_NULL)
1205+
end
1206+
end
1207+
end
11991208

12001209
return Reactant.TracedUtils.CompiledMlirFnResult(
12011210
fnwrapped,

src/TPUs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function download_libtpu_if_needed(path=nothing)
3838
@assert path !== nothing "libtpu_dir is not set!"
3939
if !isfile(path * "/libtpu.so")
4040
Downloads.download(
41-
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250313+nightly-py3-none-manylinux_2_31_x86_64.whl",
41+
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250326+nightly-py3-none-manylinux_2_31_x86_64.whl",
4242
path * "/tpu.zip",
4343
)
4444
run(`unzip -qq $(path*"/tpu.zip") -d $(path)/tmp`)

0 commit comments

Comments
 (0)