diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9067e54..4aed1cf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,11 +1,24 @@ name: CI on: - - push - - pull_request + push: + branches: + - master + tags: ['*'] + pull_request: + workflow_dispatch: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 + permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created + actions: write + contents: read strategy: fail-fast: false matrix: @@ -17,22 +30,17 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v5 with: - coverage: false + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + slug: TensorBFS/TropicalGEMM.jl \ No newline at end of file diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b..2bacdb8 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: 3 +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/src/gemm.jl b/src/gemm.jl index f3876c2..acf8d7a 100644 --- a/src/gemm.jl +++ b/src/gemm.jl @@ -1,7 +1,9 @@ -const BlasSemiringTypes{T} = Union{Tropical{T}, TropicalMinPlus{T}, TropicalMaxMul{T}} +const BlasSemiringTypes{T} = Union{Tropical{T}, TropicalMinPlus{T}, TropicalMaxMul{T}, TropicalMaxMin{T}, TropicalBitwise{T}} basetype(::Type{<:Tropical}) = Tropical basetype(::Type{<:TropicalMinPlus}) = TropicalMinPlus basetype(::Type{<:TropicalMaxMul}) = TropicalMaxMul +basetype(::Type{<:TropicalMaxMin}) = TropicalMaxMin +basetype(::Type{<:TropicalBitwise}) = TropicalBitwise # implement neginf for Vec and VecUnroll TropicalNumbers.neginf(::Type{Vec{N, T}}) where {N,T} = Vec(ntuple(i->neginf(T), N)...) @@ -10,7 +12,7 @@ TropicalNumbers.neginf(::Type{VecUnroll{N,W,T,V}}) where {N,W,T,V} = VecUnroll(n LoopVectorization.check_args(::Type{T}, ::Type{T}) where T<:BlasSemiringTypes = true LoopVectorization.check_type(::Type{<:BlasSemiringTypes{T}}) where {T} = LoopVectorization.check_type(T) -for TT in [:Tropical, :TropicalMaxMul, :TropicalMinPlus] +for TT in [:Tropical, :TropicalMinPlus, :TropicalMaxMul, :TropicalMaxMin, :TropicalBitwise] @eval @inline function VectorizationBase._vstore!( ptr::AbstractStridedPointer, vu::$TT{<:VecUnroll{Nm1,W}}, u::Unroll{AU,F,N,AV,W}, a::A, s::S, nt::NT, si::StaticInt{RS} ) where {A<:StaticBool,S<:StaticBool,NT<:StaticBool,RS,AU,F,N,AV,W,Nm1} @@ -101,7 +103,8 @@ for TP in [:NativeTypes, :AbstractSIMD] for (TT, F0, F1) in [ (:Tropical, :max_fast, :add_fast), (:TropicalMinPlus, :min_fast, :add_fast), - (:TropicalMaxMul, :max_fast, :mul_fast) + (:TropicalMaxMul, :max_fast, :mul_fast), + (:TropicalMaxMin, :max_fast, :min_fast), ] @eval @inline function Base.fma(x::$TT{V}, y::$TT{V}, z::$TT{V}) where {V<:$TP} $TT(Base.FastMath.$F0(content(z), Base.FastMath.$F1(content(x), content(y)))) @@ -136,7 +139,9 @@ end for (TT, F0, F1, F2, F3, F4) in [ (:Tropical, :max_fast, :collapse_max, :contract_max, :reduced_max, :vmaximum), (:TropicalMinPlus, :min_fast, :collapse_min, :contract_min, :reduced_min, :vminimum), - (:TropicalMaxMul, :max_fast, :collapse_max, :contract_max, :reduced_max, :vmaximum) + (:TropicalMaxMul, :max_fast, :collapse_max, :contract_max, :reduced_max, :vmaximum), + (:TropicalMaxMin, :max_fast, :collapse_max, :contract_max, :reduced_max, :vmaximum), + (:TropicalBitwise, :|, :collape_or, :contract_or, :reduced_any, :vany), ] @eval @inline Base.FastMath.add_fast(a::$TT, b::$TT) = $TT(Base.FastMath.$F0(content(a), content(b))) diff --git a/test/gemm.jl b/test/gemm.jl index bf3b7fc..cebd624 100644 --- a/test/gemm.jl +++ b/test/gemm.jl @@ -93,11 +93,15 @@ end @test !any(isnan, res) end -@testset "MinPlus and MaxMul" begin +@testset "MinPlus, MaxMul, MaxMin, and Bitwise" begin for (T1,T2) in [ [TropicalMinPlusF64, TropicalMinPlusF64], [TropicalMinPlus{Int64}, TropicalMinPlus{Int64}], - [TropicalMaxMulF64, TropicalMaxMulF64], [TropicalMaxMul{Int64}, TropicalMaxMul{Int64}] + [TropicalMaxMulF64, TropicalMaxMulF64], + [TropicalMaxMul{Int64}, TropicalMaxMul{Int64}], + [TropicalMaxMinF64, TropicalMaxMinF64], + [TropicalMaxMinI64, TropicalMaxMinI64], + [TropicalBitwiseI64, TropicalBitwiseI64], ] for n in [0, 1, 4, 40] A = _rand(T1, n, n) @@ -124,4 +128,4 @@ end end end end -end \ No newline at end of file +end