Skip to content

[Bug]: Kernel execution incorrectly depends on the Python kernel name #4

Description

@Perinban

Problem

MetaXuda currently appears to select the Metal operation from the Python kernel name instead of determining it from the compiled CUDA/PTX kernel body.

For example, a kernel using sine may only work when the function is named sin or an accepted alias such as sine. The same kernel body may fail when the function has another valid name such as apply_sine or transform.

Reproduction

import math
import numpy as np
from numba import cuda
import metaxuda

@cuda.jit
def sin(values, output):
    i = cuda.grid(1)
    if i < values.size:
        output[i] = math.sin(values[i])

@cuda.jit
def apply_sine(values, output):
    i = cuda.grid(1)
    if i < values.size:
        output[i] = math.sin(values[i])

1. Run the `sin` kernel with the normal MetaXuda buffer and launch flow.
2. Confirm that the sine operation works.
3. Run the equivalent `apply_sine` kernel with the same input and launch configuration.
4. Observe that the second kernel is not mapped or does not execute as the sine operation.

Both kernels have the same operation in their bodies; only the Python function name differs.

Expected behaviour

MetaXuda should determine the operation from the compiled CUDA/PTX kernel body.

Both sin and apply_sine should produce the same output because both kernels call math.sin. Any valid Python kernel name should work.

Error output

The runtime may report that it cannot find a kernel mapping for the renamed kernel, or it may execute the wrong operation.

Example:

Failed to get kernel mapping: apply_sine
Kernel launch failed

The exact error may vary, but the key symptom is that `sin` works while an equivalent kernel such as `apply_sine` does not.

Area

Runtime

macOS version

26.5.2

Apple Silicon model

MacBook Air (Apple M1, 8 GB)

Python, Numba, and MetaXuda versions

Python 3.13.3, Numba 0.66.0, MetaXuda 2.0.1

Checks

  • I searched existing issues before opening this report.
  • I removed credentials, tokens, and personal paths from the report.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions