Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Shape to be used in Front benchmarks #108

Merged
merged 1 commit into from
Nov 8, 2024
Merged
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
6 changes: 4 additions & 2 deletions src/linting/extended_checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
!is_there_any_star_marker && return x == y

contains(x, "QQQ") && contains(y, "QQQ") &&
throw(BothCannotHaveStarException("Cannot both $x and $y have a star marker"))

Check failure on line 58 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

if contains(x, "QQQ")
reg_exp = Regex(replace(x, "QQQ" => ".*"))
return !isnothing(match(reg_exp, y))
Expand Down Expand Up @@ -290,7 +290,7 @@

function check(t::InitializingWithFunctionRule, x::EXPR, markers::Dict{Symbol,String})
# If we are not in a const statement, then we exit this function.
haskey(markers, :const) || return

Check failure on line 293 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
generic_check(t, x, "Threads.nthreads()", "`Threads.nthreads()` should not be used in a constant variable.")
generic_check(t, x, "is_local_deployment()", "`is_local_deployment()` should not be used in a constant variable.")
generic_check(t, x, "Deployment.is_local_deployment()", "`Deployment.is_local_deployment()` should not be used in a constant variable.")
Expand Down Expand Up @@ -346,11 +346,11 @@
check(t::PtrRule, x::EXPR) = generic_check(t, x, "Ptr{hole_variable}(hole_variable)")

function check(t::ArrayWithNoTypeRule, x::EXPR, markers::Dict{Symbol,String})
haskey(markers, :filename) || return

Check failure on line 349 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
contains(markers[:filename], "src/Compiler") || return

haskey(markers, :macrocall) && markers[:macrocall] == "@match" && return

Check failure on line 352 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
haskey(markers, :macrocall) && markers[:macrocall] == "@matchrule" && return

Check failure on line 353 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.

generic_check(t, x, "[]", "Need a specific Array type to be provided.")
end
Expand Down Expand Up @@ -390,7 +390,7 @@
end

function check(t::UnsafeRule, x::EXPR, markers::Dict{Symbol,String})
haskey(markers, :function) || return

Check failure on line 393 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
isnothing(match(r"_unsafe_.*", markers[:function])) || return
isnothing(match(r"unsafe_.*", markers[:function])) || return

Expand Down Expand Up @@ -486,7 +486,7 @@
end

function check(t::RelPathAPIUsageRule, x::EXPR, markers::Dict{Symbol,String})
haskey(markers, :filename) || return

Check failure on line 489 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
contains(markers[:filename], "src/Compiler/Front") || return

generic_check(t, x, "hole_variable::RelPath", "Usage of type `RelPath` is not allowed in this context.")
Expand All @@ -498,14 +498,16 @@
end

function check(t::NonFrontShapeAPIUsageRule, x::EXPR, markers::Dict{Symbol,String})
haskey(markers, :filename) || return

Check failure on line 501 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `thaskey(dict,key)` instead of the Julia's `haskey`.
# In the front-end and in FFI, we are allowed to refer to `Shape`
contains(markers[:filename], "src/FrontCompiler") && return
contains(markers[:filename], "src/FFI") && return
contains(markers[:filename], "src/FrontIR") && return
# Also, allow usages in tests
# Allow usage in Front benchmarks
contains(markers[:filename], "bench/Front") && return
# Allow usages in tests
contains(markers[:filename], "test/") && return
# Also, allow usages of the name `Shape` in `packages/` although they refer to a different thing.
# Allow usages of the name `Shape` in `packages/` although they refer to a different thing.
contains(markers[:filename], "packages/RAI_Protos/src/proto/metadata.proto") && return
contains(markers[:filename], "packages/RAI_Protos/src/gen/relationalai/protocol/metadata_pb.jl") && return

Expand All @@ -531,7 +533,7 @@
is_safe_macro_call(y) =
y.head == :macrocall && y.args[1].head == :IDENTIFIER && y.args[1].val == "@safe"

is_safe_literal(x) = x.head in [:NOTHING,

Check failure on line 536 in src/linting/extended_checks.jl

View workflow job for this annotation

GitHub Actions / run_lint

Use `tin(item,collection)` instead of the Julia's `in` or `∈`.
:INTEGER,
:FLOAT,
:TRUE,
Expand Down
Loading