From b2b50673e9495155ca0218d532a24aeb25e9e5a5 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 9 Nov 2025 12:26:45 -0600 Subject: [PATCH 1/5] fix: build for cuda 13 + mac --- deps/ReactantExtra/API.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deps/ReactantExtra/API.cpp b/deps/ReactantExtra/API.cpp index 9ec4a9e353..db61b82fae 100644 --- a/deps/ReactantExtra/API.cpp +++ b/deps/ReactantExtra/API.cpp @@ -914,8 +914,9 @@ CudaGetStreamExecutorDeviceDescription(int32_t device_id) { // Memory bandwidth (bytes/sec) ≈ 2 * memClock(Hz) * busWidth(bytes) // props.memoryClockRate is in kHz; bus width is in bits. - const double mem_clock_hz = - static_cast(props.memoryClockRate) * 1000.0; + const double mem_clock_hz = static_cast(GetCudaIntegerAttribute( + cudaDevAttrMemoryClockRate, device_id)) * + 1000.0; const double bus_bytes = static_cast(props.memoryBusWidth) / 8.0; const double bandwidth_Bps = 2.0 * mem_clock_hz * bus_bytes; // DDR assumption device_description->set_memory_bandwidth( @@ -925,8 +926,10 @@ CudaGetStreamExecutorDeviceDescription(int32_t device_id) { GetCudaIntegerAttribute(cudaDevAttrL2CacheSize, device_id)); // SM clock (GHz). props.clockRate is kHz. - device_description->set_clock_rate_ghz(static_cast(props.clockRate) / - 1.0e6); + device_description->set_clock_rate_ghz( + static_cast( + GetCudaIntegerAttribute(cudaDevAttrClockRate, device_id)) / + 1.0e6); device_description->set_device_memory_size(props.totalGlobalMem); // Registers @@ -3480,7 +3483,7 @@ REACTANT_ABI void EstimateRunTimeForInstruction( #else -REACTANT_ABI void *CreateGPUPerformanceModelWrapper( +REACTANT_ABI void *CreateGPUPerformanceModel( MlirContext ctx, stream_executor::DeviceDescription *device_description) { return nullptr; } From 22a1b0c946f1f4aa6d4ef740c7c686c55eecc172 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 9 Nov 2025 12:36:01 -0600 Subject: [PATCH 2/5] ci: build reactant jll --- .github/workflows/build-reactantjll.yml | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/build-reactantjll.yml diff --git a/.github/workflows/build-reactantjll.yml b/.github/workflows/build-reactantjll.yml new file mode 100644 index 0000000000..a400b379f0 --- /dev/null +++ b/.github/workflows/build-reactantjll.yml @@ -0,0 +1,27 @@ +name: "Build Reactant_jll" + +on: + pull_request: + branches: + - main + paths: + - ".github/workflows/build-reactantjll.yml" + - "deps/ReactantExtra/API.cpp" + - "deps/ReactantExtra/BUILD" + - "deps/ReactantExtra/WORKSPACE" + - "deps/ReactantExtra/workspace.bzl" + +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: + build-jll: + name: Build Reactant_jll + if: github.event.pull_request.draft == false + uses: EnzymeAD/ReactantBuilder/.github/workflows/build-reactant-reusable.yml@main + with: + reactantbuilder_ref: "main" + reactant_commit: ${{ github.sha }} From f4683eb5769d030135daea5a896a6f9029ee23de Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 9 Nov 2025 12:51:42 -0600 Subject: [PATCH 3/5] ci: pass in enzyme_jax_commit to reduce builds --- .github/workflows/build-reactantjll.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/build-reactantjll.yml b/.github/workflows/build-reactantjll.yml index a400b379f0..5739bc836d 100644 --- a/.github/workflows/build-reactantjll.yml +++ b/.github/workflows/build-reactantjll.yml @@ -18,10 +18,29 @@ concurrency: cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: + enzyme-jax-commit: + name: Extract ENZYMEXLA_COMMIT from WORKSPACE + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract ENZYMEXLA_COMMIT from WORKSPACE + id: extract_enzyme_jax_commit + run: | + ENZYMEXLA_COMMIT=$(grep -oP 'ENZYMEXLA_COMMIT = "\K[^"]+' deps/ReactantExtra/WORKSPACE) + echo "enzyme_jax_commit=$ENZYMEXLA_COMMIT" >> $GITHUB_OUTPUT + outputs: + enzyme_jax_commit: ${{ steps.extract_enzyme_jax_commit.outputs.enzyme_jax_commit }} + build-jll: name: Build Reactant_jll if: github.event.pull_request.draft == false uses: EnzymeAD/ReactantBuilder/.github/workflows/build-reactant-reusable.yml@main + needs: enzyme-jax-commit with: reactantbuilder_ref: "main" reactant_commit: ${{ github.sha }} + enzyme_jax_commit: ${{ needs.enzyme-jax-commit.outputs.enzyme_jax_commit }} From 911282d86582849445cb78a19f401ae6ed736bcb Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 9 Nov 2025 16:45:51 -0500 Subject: [PATCH 4/5] Apply suggestion from @avik-pal --- .github/workflows/build-reactantjll.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-reactantjll.yml b/.github/workflows/build-reactantjll.yml index 5739bc836d..02ce359d60 100644 --- a/.github/workflows/build-reactantjll.yml +++ b/.github/workflows/build-reactantjll.yml @@ -1,7 +1,7 @@ name: "Build Reactant_jll" on: - pull_request: + pull_request_target: branches: - main paths: From ebe125219d98c20d2577d5c9ef8d039005444434 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 9 Nov 2025 16:50:51 -0500 Subject: [PATCH 5/5] Apply suggestion from @avik-pal --- .github/workflows/build-reactantjll.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-reactantjll.yml b/.github/workflows/build-reactantjll.yml index 02ce359d60..03aa64c7ad 100644 --- a/.github/workflows/build-reactantjll.yml +++ b/.github/workflows/build-reactantjll.yml @@ -1,7 +1,7 @@ name: "Build Reactant_jll" on: - pull_request_target: + pull_request: branches: - main paths: @@ -42,5 +42,5 @@ jobs: needs: enzyme-jax-commit with: reactantbuilder_ref: "main" - reactant_commit: ${{ github.sha }} + reactant_commit: ${{ github.event.pull_request.head.sha }} enzyme_jax_commit: ${{ needs.enzyme-jax-commit.outputs.enzyme_jax_commit }}