Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
96ffc67
eagerly use all vended numba.cuda modules
isVoid Nov 6, 2025
c93c98a
skip unknown types in struct conversion operator gen
isVoid Nov 20, 2025
b72a05c
factor out prefix removal helper
isVoid Nov 20, 2025
a4d078f
move singular regular method to standalone class, support prefix remo…
isVoid Nov 20, 2025
85271f7
add __nv_bfloat16 test to existing support
isVoid Nov 21, 2025
1582880
support removal of enum prefix, and expose enums to __all__
isVoid Nov 21, 2025
e4d45d4
Merge branch 'main' into fea-fp8-support
isVoid Dec 1, 2025
8258429
Merge branch 'main' of github.com:NVIDIA/numbast into fea-fp8-support
isVoid Dec 3, 2025
70001df
add bfloat16_raw type to type system
isVoid Dec 4, 2025
3979ad2
use target registry lower_cast registerer in separate registry mode
isVoid Dec 4, 2025
b332cbe
Merge branch 'main' of github.com:NVIDIA/numbast into bump_numba-cuda…
isVoid Dec 4, 2025
df501fe
pin numba-cuda versions to >=0.21.0
isVoid Dec 4, 2025
5b10afb
document version requirements for bindings v.s. numba-cuda
isVoid Dec 4, 2025
0fe0bf0
check on numba.cuda.types
isVoid Dec 4, 2025
fa5f7af
avoid unused parameter
isVoid Dec 4, 2025
0375b48
use numba_typeref_ctor from vended module
isVoid Dec 4, 2025
855507a
Merge branch 'bump_numba-cuda_ver' into fea-fp8-support
isVoid Dec 4, 2025
ac0afbf
adding cudaroundmode enum to type system
isVoid Dec 9, 2025
71be418
Merge branch 'main' into fea-fp8-support
isVoid Dec 24, 2025
3ea27f9
pass through clang binary path to tooling
isVoid Dec 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ast_canopy/ast_canopy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def parse_declarations_from_source(
# 3. CUDA Toolkit include directories
# 4. Additional include directories
command_line_options = [
"clang++",
clang_binary if not None else "clang++",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix the conditional expression logic.

The condition if not None always evaluates to True, which means clang_binary will be used even when it's None, causing the command to fail. The correct check should verify whether clang_binary itself is None.

🔎 Proposed fix
-        clang_binary if not None else "clang++",
+        clang_binary if clang_binary is not None else "clang++",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
clang_binary if not None else "clang++",
clang_binary if clang_binary is not None else "clang++",
🤖 Prompt for AI Agents
In ast_canopy/ast_canopy/api.py around line 436, the conditional expression uses
`if not None` which always true; change it to check the variable itself (e.g.
`clang_binary if clang_binary is not None else "clang++"`) so that when
clang_binary is None the fallback "clang++" is used; update the expression
accordingly and run tests to verify command invocation.

*clang_verbose_flag,
"--cuda-device-only",
"-xcuda",
Expand Down
21 changes: 14 additions & 7 deletions numbast/src/numbast/static/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,20 @@ def _render(self):
"""Render all struct constructors."""

for convop_decl in self._convop_decls:
renderer = StaticStructConversionOperatorRenderer(
struct_name=self._struct_name,
struct_type_class=self._struct_type_class,
struct_type_name=self._struct_type_name,
header_path=self._header_path,
convop_decl=convop_decl,
)
try:
renderer = StaticStructConversionOperatorRenderer(
struct_name=self._struct_name,
struct_type_class=self._struct_type_class,
struct_type_name=self._struct_type_name,
header_path=self._header_path,
convop_decl=convop_decl,
)
except TypeNotFoundError as e:
warnings.warn(
f"{e._type_name} is not known to Numbast. Skipping "
f"binding for {str(convop_decl)}"
)
continue
renderer._render()

self._python_rendered += renderer._python_rendered
Expand Down
4 changes: 4 additions & 0 deletions numbast/src/numbast/static/tests/data/bf16.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ nv_bfloat16 inline __device__ add(nv_bfloat16 a, nv_bfloat16 b) {
return a + b;
}

__nv_bfloat16 inline __device__ add2(__nv_bfloat16 a, __nv_bfloat16 b) {
return a + b;
}

__nv_bfloat16_raw inline __device__ bf16_to_raw(nv_bfloat16 a) {
return __nv_bfloat16_raw(a);
}
Expand Down
5 changes: 4 additions & 1 deletion numbast/src/numbast/static/tests/test_bf16_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ def test_bindings_from_bf16(make_binding):
binding1 = res1["bindings"]

add = binding1["add"]
add2 = binding1["add2"]

@cuda.jit
def kernel(arr):
x = add(bfloat16(3.14), bfloat16(3.14))
arr[0] = float32(x)
arr[1] = float32(add2(bfloat16(3.14), bfloat16(3.14)))

arr = cuda.device_array((1,), dtype="float32")
arr = cuda.device_array((2,), dtype="float32")
kernel[1, 1](arr)

assert pytest.approx(arr[0], 1e-2) == 6.28
assert pytest.approx(arr[1], 1e-2) == 6.28

# Check that bfloat16 is imported
assert "from numba.cuda.types import bfloat16" in res1["src"]
Expand Down
1 change: 1 addition & 0 deletions numbast/src/numbast/static/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def register_enum_type_str(
Parameters:
ctype_enum_name (str): The C++ enum type name to register (as it appears in C/C++ headers).
enum_name (str): The enum identifier to use inside the generated Numba type string (becomes the first argument to `IntEnumMember`).
underlying_integer_type (str): The underlying integer type to use for the enum.
"""
global CTYPE_TO_NBTYPE_STR

Expand Down
3 changes: 3 additions & 0 deletions numbast/src/numbast/tools/tests/test_prefix_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def test_prefix_removal(run_in_isolated_folder, arch_str):
symbols = res["symbols"]
alls = symbols["__all__"]

binding_path = res["binding_path"]
print(f"{binding_path=}")

assert run_result.exit_code == 0

# Verify that the function is exposed as "foo" (without the "prefix_" prefix)
Expand Down
8 changes: 8 additions & 0 deletions numbast/tests/data/sample_function.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// clang-format off
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
// clang-format on

#pragma once

__device__ void func_with_void_ptr_arg(void *ptr) { (void)ptr; }
Loading