Skip to content

Commit f958810

Browse files
chore: rm state type param
1 parent 77a9fc5 commit f958810

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/hvncat_static_opt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118
is_small_hvncat(rows::Int) = rows <= 16 # For vectors
119119

120120
"""
121-
detect_hvncat_pattern(expr::Code.Let, state::Code.CSEState) -> Union{Nothing, Vector{HvncatMatch}}
121+
detect_hvncat_pattern(expr::Code.Let, state) -> Union{Nothing, Vector{HvncatMatch}}
122122
123123
Detect hvncat/hcat/vcat operations that construct small literal arrays.
124124
@@ -129,7 +129,7 @@ Examples of what this detects:
129129
130130
For small arrays (≤ 4×4), these will be converted to StaticArrays.
131131
"""
132-
function detect_hvncat_pattern(expr::Code.Let, state::Code.CSEState)
132+
function detect_hvncat_pattern(expr::Code.Let, state)
133133
matches = HvncatMatch[]
134134

135135
for (idx, pair) in enumerate(expr.pairs)
@@ -176,17 +176,17 @@ end
176176

177177
"""
178178
transform_hvncat_to_static(expr::Code.Let, match_data::Union{Nothing, Vector{HvncatMatch}},
179-
state::Code.CSEState) -> Code.Let
179+
state) -> Code.Let
180180
181181
Transform hvncat operations to StaticArray constructors.
182182
183183
Converts:
184184
- `A = [1 2; 3 4]` → `A = SMatrix{2,2}(1, 2, 3, 4)`
185185
- `v = [1, 2, 3]` → `v = SVector{3}(1, 2, 3)`
186186
"""
187-
transform_hvncat_to_static(expr, ::Nothing, state::Code.CSEState) = expr
187+
transform_hvncat_to_static(expr, ::Nothing, state) = expr
188188
function transform_hvncat_to_static(expr::Code.Let, match_data::Vector{HvncatMatch},
189-
state::Code.CSEState)
189+
state)
190190
isempty(match_data) && return expr
191191

192192
# Build transformation plan

src/la_opt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const TRIL_RULE = GenericRule("tril", LinearAlgebra.tril, LinearAlgebra.tril!, 8
7575
const NORMALIZE_RULE = GenericRule("normalize", LinearAlgebra.normalize, LinearAlgebra.normalize!, 8)
7676
# const CONJ_RULE = GenericRule("conj", LinearAlgebra.conj, LinearAlgebra.conj!, 8)
7777

78-
function triu_opt(expr, state::CSEState)
78+
function triu_opt(expr, state)
7979
# Try to apply optimization rules
8080
optimized = apply_optimization_rules(expr, state, TRIU_RULE)
8181
if optimized !== nothing

src/ldiv_opt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ struct LdivMatch{Ta, Tb, S <: Assignment, P <: AbstractString} <: AbstractMatche
99
end
1010

1111
"""
12-
detect_ldiv_pattern(expr::Code.Let, state::Code.CSEState) -> Vector{LdivMatch}
12+
detect_ldiv_pattern(expr::Code.Let, state) -> Vector{LdivMatch}
1313
1414
Detect patterns of the form `result = A \\ B` where both A and B are arrays.
1515
"""
16-
function detect_ldiv_pattern(expr::Code.Let, state::Code.CSEState)
16+
function detect_ldiv_pattern(expr::Code.Let, state)
1717
ldiv_candidates_idx = findall(expr.pairs) do x
1818
r = rhs(x)
1919
iscall(r) || return false
@@ -192,14 +192,14 @@ function ldiv_transformation(safe_matches, ::Val{false})
192192
end
193193

194194
"""
195-
transform_to_ldiv_inplace(expr::Code.Let, match_data, state::Code.CSEState) -> Code.Let
195+
transform_to_ldiv_inplace(expr::Code.Let, match_data, state) -> Code.Let
196196
197197
Transform `result = A \\ B` to:
198198
result = ldiv!(A, B)
199199
200200
This performs in-place linear solve, overwriting B with the result.
201201
"""
202-
function transform_to_ldiv_inplace(expr::Code.Let, match_data::AbstractVector, state::Code.CSEState)
202+
function transform_to_ldiv_inplace(expr::Code.Let, match_data::AbstractVector, state)
203203
# Validate all matches
204204
safe_matches = filter(match_data) do match
205205
is_safe = is_safe_to_optimize_ldiv(match, expr)
@@ -217,7 +217,7 @@ function transform_to_ldiv_inplace(expr::Code.Let, match_data::AbstractVector, s
217217

218218
return Code.Let(new_pairs, expr.body, expr.let_block)
219219
end
220-
transform_to_ldiv_inplace(expr::Code.Let, match_data::Nothing, state::Code.CSEState) = expr
220+
transform_to_ldiv_inplace(expr::Code.Let, match_data::Nothing, state) = expr
221221

222222
# Create the optimization rule
223223
const LDIV_RULE = OptimizationRule(

src/matmuladd.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct MatMulAddMatch{At, Bt, Ct} <: AbstractMatched
1212
end
1313

1414
"""
15-
detect_matmul_add_pattern(expr::Code.Let, state::Code.CSEState) -> Union{Nothing, Vector{MatMulAddMatch}}
15+
detect_matmul_add_pattern(expr::Code.Let, state) -> Union{Nothing, Vector{MatMulAddMatch}}
1616
1717
Attempts to detect patterns of the form:
1818
@@ -30,7 +30,7 @@ result = temp
3030
3131
`A` and `B` must not be aliased.
3232
"""
33-
function detect_matmul_add_pattern(expr::Code.Let, state::Code.CSEState)
33+
function detect_matmul_add_pattern(expr::Code.Let, state)
3434
mul_candidates_idx = findall(expr.pairs) do x
3535
r = rhs(x)
3636
iscall(r) || return false
@@ -88,8 +88,8 @@ function get_from_cache(x)
8888
end
8989
end
9090

91-
transform_to_mul5_assignment(expr, ::Tuple{Union{Nothing, AbstractVector{Nothing}, Tuple{Nothing, Nothing}}, <:Any}, state::Code.CSEState) = expr
92-
function transform_to_mul5_assignment(expr, match_data_, state::Code.CSEState)
91+
transform_to_mul5_assignment(expr, ::Tuple{Union{Nothing, AbstractVector{Nothing}, Tuple{Nothing, Nothing}}, <:Any}, state) = expr
92+
function transform_to_mul5_assignment(expr, match_data_, state)
9393
match_data_, net_additive_terms = match_data_
9494
match_data_ === nothing && return expr
9595
Cset = Set(Iterators.flatten(getproperty.(match_data_, :Cs)))

0 commit comments

Comments
 (0)