Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
719ac73
Working prototype with creation and readout
isVoid Mar 29, 2022
6d7ac9b
Second attmpet on working example
isVoid Apr 12, 2022
e01c497
Style fixes
isVoid Apr 12, 2022
dc6223a
Remove binop logics and minor cleanups
isVoid Apr 12, 2022
c6f5f4e
Initial to fancy creation
isVoid Apr 12, 2022
8430abc
cleanups
isVoid Apr 12, 2022
8864af8
Add documentation for vector types
isVoid Apr 14, 2022
61a97a3
Various docstring updates.
isVoid Apr 27, 2022
db84a5d
Delete stub lists to avoid leaking to global environment
isVoid Apr 27, 2022
7635410
Merge branch 'fea/cuda_vector_types' of github.com:isVoid/numba into …
isVoid Apr 27, 2022
a0e9e2d
wrap vtype stubs in factory method to avoid variable leaking
isVoid Apr 27, 2022
daa82e3
Make stub more descriptive
isVoid Apr 27, 2022
d904a5b
Update prefix
isVoid May 2, 2022
a1b449b
Aliased vector types
isVoid May 2, 2022
d924c2a
Dynamically determine the stub to alias mapping
isVoid May 2, 2022
da5e299
Apply Graham's change to exploit python's module import-once.
isVoid May 16, 2022
dba5825
Update documentations
isVoid May 16, 2022
2720d23
Add comment to test case
isVoid May 16, 2022
5bfccc5
fix 1-component vector type in ctor, add coverage
isVoid May 17, 2022
b02740f
Fix type annotations for
isVoid May 17, 2022
fd49c27
skip vector type test in simulator
isVoid May 17, 2022
c160b63
fix attr_names type annotation
isVoid May 18, 2022
02b9db3
Apply several documentation updates
isVoid May 18, 2022
4449e84
move `type` page link under cuda-reference
isVoid May 18, 2022
2d72d9d
update built-in types link
isVoid May 18, 2022
9c1f6b9
Add field accessing demo code, update ctor demo
isVoid May 18, 2022
baac6b7
Add comments to separate out the result array, fix jagged comment ind…
isVoid May 18, 2022
4633470
Fix argument type annotation
isVoid May 19, 2022
457c91d
Minor doc updates
isVoid May 20, 2022
467a865
add simulator vector type
isVoid May 21, 2022
2522b85
Add missing vector type fake module
isVoid May 21, 2022
96a1968
Remove stale breakpoint
isVoid May 23, 2022
7deb8db
Asserts with number of elements
isVoid May 25, 2022
7b8711f
fix typo
isVoid May 25, 2022
1260b82
Separate tests with subtest
isVoid May 25, 2022
27e0427
wrap each test in subtest
isVoid May 25, 2022
ac91dfa
revert to only test construction with name
isVoid May 25, 2022
cbf41bd
several comment update
isVoid May 25, 2022
aabfb33
optimize simulator vector types code paths
isVoid May 25, 2022
60d872e
Merge branch 'main' into fea/cuda_vector_types
isVoid May 25, 2022
a43a474
Commit docs suggestions
isVoid May 25, 2022
cfe863a
better error with mismatch number of arguments when constructing simu…
isVoid May 25, 2022
4faf3f5
Raise more sensible error for simulator vector types.
isVoid May 25, 2022
d95ac9f
Add a basic sanity check test case
isVoid May 25, 2022
cc652b4
Insert the vector types in fake cuda module.
isVoid May 25, 2022
556174f
Remove leading empty line
isVoid May 25, 2022
a29bc97
Address various review comments
isVoid Jun 6, 2022
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
14 changes: 8 additions & 6 deletions docs/source/cuda-reference/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ Vector Types
~~~~~~~~~~~~

`CUDA Vector Types <https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#built-in-vector-types>`_
are available in the kernel. Unlike native CUDA, vector types are constructed
directly with their constructor. For example, to construct a ``float3``:
are available in the kernel. Unlike native CUDA where factory functions are
used, vector types are constructed directly with their constructor. For example,
to construct a ``float3``:

.. code-block:: python3

Expand All @@ -553,8 +554,8 @@ directly with their constructor. For example, to construct a ``float3``:
# In kernel
f3 = float3(float32(0.0), float32(-1.0), float32(1.0))

Besides, vector type can be constructed from a combination of vector types and
primitive types, as long as the total number of components matches with the result
Additionally, vector types can be constructed from a combination of vector and
primitive types, as long as the total number of components matches the result
vector type. For example, all of the following constructions are valid:

.. code-block:: python3
Expand All @@ -567,5 +568,6 @@ vector type. For example, all of the following constructions are valid:
u4 = uint4(u2, u2)

The 1st, 2nd, 3rd and 4th component of the vector type can be accessed through fields
``x``, ``y``, ``z``, ``w``, respectively. The components are currently immutable
after construction.
``x``, ``y``, ``z``, and ``w`` respectively. The components are immutable after
construction in the present version of Numba; it is expected that support for
mutating vector components will be added in a future release.
2 changes: 1 addition & 1 deletion numba/cuda/device_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

reduce = Reduce = reduction.Reduce

# Expose vector types constructors as module level attributes.
# Expose vector type constructors as module level attributes.
for vector_type_stub in _vector_type_stubs:
Comment thread
isVoid marked this conversation as resolved.
Resolved
setattr(sys.modules[__name__], vector_type_stub.__name__, vector_type_stub)
del vector_type_stub, _vector_type_stubs
Expand Down