Skip to content

[GPU] exchange LLVM optimization pass apply to GPU instead of host#830

Merged
arshajii merged 1 commit into
exaloop:developfrom
BI71317:pr-GPU-opt-passes-unapplied
Jun 30, 2026
Merged

[GPU] exchange LLVM optimization pass apply to GPU instead of host#830
arshajii merged 1 commit into
exaloop:developfrom
BI71317:pr-GPU-opt-passes-unapplied

Conversation

@BI71317

@BI71317 BI71317 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

fixes #829

Changes

  • updates the NVPTX optimization pipeline so that gpuopt1 and gpuopt2 run on the prepared GPU module instead of the host module.

Before:

runLLVMOptimizationPasses(module, /*plugins=*/nullptr, &gpuOptions);

After:

runLLVMOptimizationPasses(GPUmodule.get(), /*plugins=*/nullptr, &gpuOptions);

MRE

$ /usr/local/cuda-12.3/bin/ptxas -arch=sm_50 -v 02_gpu_exp_on_expr_with_rel.ptx -o 02_gpu_exp_on_expr_with_rel_no_mo.cubin
ptxas info    : 0 bytes gmem
ptxas info    : Compiling entry function 'exp_kernel_naver_02_0_0_std_numpy_ndarray_ndarray_0_float32_1__std_numpy_ndarray_ndarray_0_float32_1__' for 'sm_50'
ptxas info    : Function properties for exp_kernel_naver_02_0_0_std_numpy_ndarray_ndarray_0_float32_1__std_numpy_ndarray_ndarray_0_float32_1__
    8 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 29 registers, 368 bytes cmem[0], 16 bytes cmem[2]

Now with release mode, codon pipeline generates valid ptx.

Result

$ ./02_gpu_exp_on_expr 
4 array of float32
╭─────────┬─────────┬─────────┬─────────╮
│ 0.3679  │ 1.      │ 0.1353  │ 2.7183  │
╰─────────┴─────────┴─────────┴─────────╯

@BI71317 BI71317 requested a review from arshajii as a code owner June 30, 2026 07:43
@cla-bot cla-bot Bot added the cla-signed label Jun 30, 2026
@arshajii

Copy link
Copy Markdown
Contributor

Thanks, LGTM

@arshajii arshajii merged commit 10a1469 into exaloop:develop Jun 30, 2026
9 checks passed
@BI71317 BI71317 deleted the pr-GPU-opt-passes-unapplied branch July 2, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GPU] GPU optimization passes applied host module instead of GPU module

2 participants