From e5fbf09b32f52633b7c119e197e1dc7c4c6ed6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sat, 16 Mar 2024 21:56:51 +0000 Subject: [PATCH 1/3] Set `parallel` to `false` if `parent_job` is not `nothing` (#1348) --- src/compiler.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler.jl b/src/compiler.jl index 676d1f302c..8405ccbdec 100644 --- a/src/compiler.jl +++ b/src/compiler.jl @@ -4758,7 +4758,7 @@ function GPUCompiler.codegen(output::Symbol, job::CompilerJob{<:EnzymeTarget}; target_machine = GPUCompiler.llvm_machine(primal_job.config.target) end - parallel = Threads.nthreads() > 1 + parallel = parent_job === nothing ? Threads.nthreads() > 1 : false process_module = false device_module = false if parent_job !== nothing From 573ab890d039feaa3c29dc2c9c7a243353b08c03 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Sat, 16 Mar 2024 20:33:24 -0400 Subject: [PATCH 2/3] Define `compiler_job_from_backend` (#1328) --- lib/EnzymeCore/Project.toml | 2 +- lib/EnzymeCore/src/EnzymeCore.jl | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/EnzymeCore/Project.toml b/lib/EnzymeCore/Project.toml index ad6e42e371..f8f3721aad 100644 --- a/lib/EnzymeCore/Project.toml +++ b/lib/EnzymeCore/Project.toml @@ -1,7 +1,7 @@ name = "EnzymeCore" uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" authors = ["William Moses ", "Valentin Churavy "] -version = "0.7.0" +version = "0.7.1" [compat] Adapt = "3, 4" diff --git a/lib/EnzymeCore/src/EnzymeCore.jl b/lib/EnzymeCore/src/EnzymeCore.jl index 56c200cd61..680e9e42d3 100644 --- a/lib/EnzymeCore/src/EnzymeCore.jl +++ b/lib/EnzymeCore/src/EnzymeCore.jl @@ -239,6 +239,22 @@ end function tape_type end +""" + compiler_job_from_backend(::KernelAbstractions.Backend, F::Type, TT:Type)::GPUCompiler.CompilerJob + +Returns a GPUCompiler CompilerJob from a backend as specified by the first argument to the function. + +For example, in CUDA one would do: + +```julia +function EnzymeCore.compiler_job_from_backend(::CUDABackend, @nospecialize(F::Type), @nospecialize(TT::Type)) + mi = GPUCompiler.methodinstance(F, TT) + return GPUCompiler.CompilerJob(mi, CUDA.compiler_config(CUDA.device())) +end +``` +""" +function compiler_job_from_backend end + include("rules.jl") end # module EnzymeCore From b6c02ba5be67b72435a42c6c994b87edde15ee93 Mon Sep 17 00:00:00 2001 From: Simone Carlo Surace <51025924+simsurace@users.noreply.github.com> Date: Tue, 19 Mar 2024 02:54:40 +0100 Subject: [PATCH 3/3] Add format config file and workflow (#1326) --- .JuliaFormatter.toml | 1 + .github/workflows/Format.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .JuliaFormatter.toml create mode 100644 .github/workflows/Format.yml diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000000..c7439503e1 --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1 @@ +style = "blue" \ No newline at end of file diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml new file mode 100644 index 0000000000..3f39a3fd32 --- /dev/null +++ b/.github/workflows/Format.yml @@ -0,0 +1,26 @@ +name: Format suggestions + +on: + pull_request: + +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: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: 1 + - run: | + julia -e 'using Pkg; Pkg.add("JuliaFormatter")' + julia -e 'using JuliaFormatter; format("."; verbose=true)' + - uses: reviewdog/action-suggester@v1 + with: + tool_name: JuliaFormatter + fail_on_error: true