Skip to content

Commit 1fdaed3

Browse files
authored
test: mark tests as broken instead of skipping them (#1536)
* test: mark tests as broken/skip * test: more fixes * test: more fixes * test: more fixes * test: nn tests * ci: only run failing cases (drop me) * test: print * test: reduce test configs * test: try adjusting precision * ci: restore runners * ci: run under gdb (drop me) * ci: remove gdb * fix: temporarily remove conditional in softmax * test: with highest precision for accuracy * chore: fmt
1 parent 4eb3d8a commit 1fdaed3

File tree

20 files changed

+608
-636
lines changed

20 files changed

+608
-636
lines changed

.github/workflows/CI.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ jobs:
6666
assertions: false
6767
test_group: core
6868
runtime: "IFRT"
69+
- os: linux-x86-ct6e-180-4tpu
70+
version: "1.11"
71+
assertions: false
72+
test_group: integration
73+
runtime: "IFRT"
74+
- os: linux-x86-ct6e-180-4tpu
75+
version: "1.11"
76+
assertions: false
77+
test_group: neural_networks
78+
runtime: "IFRT"
6979
- os: ubuntu-24.04
7080
version: "1.10"
7181
assertions: true
@@ -81,18 +91,18 @@ jobs:
8191
assertions: true
8292
test_group: integration
8393
runtime: "PJRT"
84-
# - os: ubuntu-24.04
85-
# libReactant: packaged
86-
# version: '1.10'
87-
# test_group: core
88-
# - os: ubuntu-24.04
89-
# libReactant: packaged
90-
# version: '1.10'
91-
# test_group: neural_networks
92-
# - os: ubuntu-24.04
93-
# libReactant: packaged
94-
# version: '1.10'
95-
# test_group: integration
94+
- os: ubuntu-24.04
95+
libReactant: packaged
96+
version: '1.10'
97+
test_group: core
98+
- os: ubuntu-24.04
99+
libReactant: packaged
100+
version: '1.10'
101+
test_group: neural_networks
102+
- os: ubuntu-24.04
103+
libReactant: packaged
104+
version: '1.10'
105+
test_group: integration
96106
steps:
97107
- name: Set TMPDIR
98108
# We have to use `${GITHUB_WORKSPACE}` instead of `github.workspace` because GitHub

ext/ReactantNNlibExt/Implementations.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ function NNlib.softmax!(out::AnyTracedRArray{T,N}, x::AbstractArray; dims=1) whe
1010
x = T.(Reactant.materialize_traced_array(x))
1111
max_ = maximum(x; dims)
1212
diff = exp.(x .- max_)
13-
@trace if all(isfinite, max_)
14-
@. out = diff
15-
else
16-
@. out = ifelse(isinf(max_), ifelse(isinf(x), T(1), T(0)), diff)
17-
end
13+
# TOOD: re-enable conditional once https://github.com/EnzymeAD/Reactant.jl/issues/1581
14+
# fixed
15+
# @trace if all(isfinite, max_)
16+
@. out = diff
17+
# else
18+
# @. out = ifelse(isinf(max_), ifelse(isinf(x), T(1), T(0)), diff)
19+
# end
1820
out ./= sum(out; dims)
1921
return out
2022
end
@@ -23,11 +25,13 @@ function NNlib.logsoftmax!(out::AnyTracedRArray{T}, x::AbstractArray; dims=1) wh
2325
x = T.(Reactant.materialize_traced_array(x))
2426
max_ = maximum(x; dims)
2527
diff = x .- max_
26-
@trace if all(isfinite, max_)
27-
@. out = diff
28-
else
29-
@. out = ifelse(isinf(max_), ifelse(isinf(x), T(0), -T(Inf)), diff)
30-
end
28+
# TOOD: re-enable conditional once https://github.com/EnzymeAD/Reactant.jl/issues/1581
29+
# fixed
30+
# @trace if all(isfinite, max_)
31+
@. out = diff
32+
# else
33+
# @. out = ifelse(isinf(max_), ifelse(isinf(x), T(0), -T(Inf)), diff)
34+
# end
3135
out .-= log.(sum(exp, out; dims))
3236
return out
3337
end

src/accelerators/TPU.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function download_libtpu_if_needed(path=nothing)
4343
zip_file_path = joinpath(path, "tpu.zip")
4444
tmp_dir = joinpath(path, "tmp")
4545
Downloads.download(
46-
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250727+nightly-py3-none-manylinux_2_31_x86_64.whl",
46+
"https://storage.googleapis.com/libtpu-nightly-releases/wheels/libtpu-nightly/libtpu_nightly-0.1.dev20250811+nightly-py3-none-manylinux_2_31_x86_64.whl",
4747
zip_file_path,
4848
)
4949
run(`$(unzip()) -qq $(zip_file_path) -d $(tmp_dir)`)

src/xla/XLA.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ function __init__()
131131
XLA_REACTANT_GPU_MEM_FRACTION[] = parse(
132132
Float64, ENV["XLA_REACTANT_GPU_MEM_FRACTION"]
133133
)
134-
@debug "XLA_REACTANT_GPU_MEM_FRACTION: " XLA_REACTANT_GPU_MEM_FRACTION[]
134+
@debug "XLA_REACTANT_GPU_MEM_FRACTION: " XLA_REACTANT_GPU_MEM_FRACTION[] maxlog =
135+
1
135136
if XLA_REACTANT_GPU_MEM_FRACTION[] > 1 || XLA_REACTANT_GPU_MEM_FRACTION[] < 0
136137
error("XLA_REACTANT_GPU_MEM_FRACTION must be between 0 and 1")
137138
end
@@ -141,16 +142,18 @@ function __init__()
141142
XLA_REACTANT_GPU_PREALLOCATE[] = parse(
142143
Bool, ENV["XLA_REACTANT_GPU_PREALLOCATE"]
143144
)
144-
@debug "XLA_REACTANT_GPU_PREALLOCATE: " XLA_REACTANT_GPU_PREALLOCATE[]
145+
@debug "XLA_REACTANT_GPU_PREALLOCATE: " XLA_REACTANT_GPU_PREALLOCATE[] maxlog =
146+
1
145147
end
146148

147149
if haskey(ENV, "REACTANT_VISIBLE_GPU_DEVICES")
148150
global_state.local_gpu_device_ids =
149151
parse.(Int, split(ENV["REACTANT_VISIBLE_GPU_DEVICES"], ","))
150-
@debug "REACTANT_VISIBLE_GPU_DEVICES: " global_state.local_gpu_device_ids
152+
@debug "REACTANT_VISIBLE_GPU_DEVICES: " global_state.local_gpu_device_ids maxlog =
153+
1
151154
end
152155

153-
@debug "REACTANT_XLA_RUNTIME: " REACTANT_XLA_RUNTIME
156+
@debug "REACTANT_XLA_RUNTIME: " REACTANT_XLA_RUNTIME maxlog = 1
154157

155158
@ccall MLIR.API.mlir_c.RegisterEnzymeXLACPUHandler()::Cvoid
156159
@ccall MLIR.API.mlir_c.RegisterEnzymeXLAGPUHandler()::Cvoid

test/autodiff.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,18 @@ end
195195
@test res2 4 * 3 * 3.1^2
196196
end
197197

198-
if !contains(string(Reactant.devices()[1]), "TPU")
199-
@testset "Seed initialization of Complex arrays on matmul: Issue #593" begin
198+
@testset "Seed initialization of Complex arrays on matmul: Issue #593" begin
199+
df(x, y) = Enzyme.gradient(ReverseWithPrimal, *, x, y)
200+
@test begin
200201
a = ones(ComplexF64, 2, 2)
201202
b = 2.0 * ones(ComplexF64, 2, 2)
202203
a_re = Reactant.to_rarray(a)
203204
b_re = Reactant.to_rarray(b)
204-
df(x, y) = Enzyme.gradient(ReverseWithPrimal, *, x, y)
205-
@test begin
206-
res = @jit df(a_re, b_re) # before, this segfaulted
207-
(res.val 4ones(2, 2)) &&
208-
(res.derivs[1] 4ones(2, 2)) &&
209-
(res.derivs[2] 2ones(2, 2))
210-
end
211-
end
205+
res = @jit df(a_re, b_re) # before, this segfaulted
206+
(res.val 4ones(2, 2)) &&
207+
(res.derivs[1] 4ones(2, 2)) &&
208+
(res.derivs[2] 2ones(2, 2))
209+
end skip = contains(string(Reactant.devices()[1]), "TPU")
212210
end
213211

214212
@testset "onehot" begin
@@ -257,7 +255,7 @@ end
257255

258256
@testset "seed" begin
259257
x = Reactant.to_rarray(rand(2, 2))
260-
st = (; rng=Reactant.ConcreteRNG())
258+
st = (; rng=Reactant.ReactantRNG())
261259

262260
@test begin
263261
hlo = @code_hlo gradient_fn(x, st)

0 commit comments

Comments
 (0)