Skip to content

Commit 46bef56

Browse files
authored
Merge pull request #844 from IntelPython/samaid_cleanup
Removed CLK_ prefix from mem fences
2 parents 3cef533 + c8f2180 commit 46bef56

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

docs/user_guides/kernel_programming_guide/synchronization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ barrier, at which point it returns control to all its callers.
1010

1111
``numba_dpex.barrier()`` supports two memory fence options:
1212

13-
- ``numba_dpex.CLK_GLOBAL_MEM_FENCE``: The barrier function will queue a memory
13+
- ``numba_dpex.GLOBAL_MEM_FENCE``: The barrier function will queue a memory
1414
fence to ensure correct ordering of memory operations to global memory. Using
1515
the option can be useful when work-items, for example, write to buffer or
1616
image objects and then want to read the updated data. Passing no arguments to
@@ -20,7 +20,7 @@ barrier, at which point it returns control to all its callers.
2020
.. literalinclude:: ../../../numba_dpex/examples/barrier.py
2121
:pyobject: no_arg_barrier_support
2222

23-
- ``numba_dpex.CLK_LOCAL_MEM_FENCE``: The barrier function will either flush
23+
- ``numba_dpex.LOCAL_MEM_FENCE``: The barrier function will either flush
2424
any variables stored in local memory or queue a memory fence to ensure
2525
correct ordering of memory operations to local memory. For example,
2626

numba_dpex/device_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# Re export
66
from .ocl.stubs import (
7-
CLK_GLOBAL_MEM_FENCE,
8-
CLK_LOCAL_MEM_FENCE,
7+
GLOBAL_MEM_FENCE,
8+
LOCAL_MEM_FENCE,
99
atomic,
1010
barrier,
1111
get_global_id,

numba_dpex/examples/kernel_private_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def private_memory_kernel(A):
2323

2424
# preload
2525
memory[0] = i
26-
numba_dpex.barrier(numba_dpex.CLK_LOCAL_MEM_FENCE) # local mem fence
26+
numba_dpex.barrier(numba_dpex.LOCAL_MEM_FENCE) # local mem fence
2727

2828
# memory will not hold correct deterministic result if it is not
2929
# private to each thread.

numba_dpex/examples/sum_reduction_ocl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def sum_reduction_kernel(A, partial_sums):
2929
stride = group_size // 2
3030
while stride > 0:
3131
# Waiting for each 2x2 addition into given workgroup
32-
dpex.barrier(dpex.CLK_LOCAL_MEM_FENCE)
32+
dpex.barrier(dpex.LOCAL_MEM_FENCE)
3333

3434
# Add elements 2 by 2 between local_id and local_id + stride
3535
if local_id < stride:

numba_dpex/examples/sum_reduction_recursive_ocl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def sum_reduction_kernel(A, input_size, partial_sums):
3434
stride = group_size // 2
3535
while stride > 0:
3636
# Waiting for each 2x2 addition into given workgroup
37-
dpex.barrier(dpex.CLK_LOCAL_MEM_FENCE)
37+
dpex.barrier(dpex.LOCAL_MEM_FENCE)
3838

3939
# Add elements 2 by 2 between local_id and local_id + stride
4040
if local_id < stride:

numba_dpex/ocl/oclimpl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def barrier_no_arg_impl(context, builder, sig, args):
153153
barrier = _declare_function(
154154
context, builder, "barrier", sig, ["unsigned int"]
155155
)
156-
flags = context.get_constant(types.uint32, stubs.CLK_GLOBAL_MEM_FENCE)
156+
flags = context.get_constant(types.uint32, stubs.GLOBAL_MEM_FENCE)
157157
builder.call(barrier, [flags])
158158
return _void_value
159159

@@ -175,7 +175,7 @@ def sub_group_barrier_impl(context, builder, sig, args):
175175
barrier = _declare_function(
176176
context, builder, "barrier", sig, ["unsigned int"]
177177
)
178-
flags = context.get_constant(types.uint32, stubs.CLK_LOCAL_MEM_FENCE)
178+
flags = context.get_constant(types.uint32, stubs.LOCAL_MEM_FENCE)
179179
builder.call(barrier, [flags])
180180
return _void_value
181181

numba_dpex/ocl/stubs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
_stub_error = NotImplementedError("This is a stub.")
66

77
# mem fence
8-
CLK_LOCAL_MEM_FENCE = 0x1
9-
CLK_GLOBAL_MEM_FENCE = 0x2
8+
LOCAL_MEM_FENCE = 0x1
9+
GLOBAL_MEM_FENCE = 0x2
1010

1111

1212
def get_global_id(*args, **kargs):

numba_dpex/tests/kernel_tests/test_atomic_op.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def get_func_local(op_type, dtype):
104104
def f(a):
105105
lm = dpex.local.array(1, dtype)
106106
lm[0] = a[0]
107-
dpex.barrier(dpex.CLK_GLOBAL_MEM_FENCE)
107+
dpex.barrier(dpex.GLOBAL_MEM_FENCE)
108108
op(lm, 0, 1)
109-
dpex.barrier(dpex.CLK_GLOBAL_MEM_FENCE)
109+
dpex.barrier(dpex.GLOBAL_MEM_FENCE)
110110
a[0] = lm[0]
111111

112112
return f

numba_dpex/tests/kernel_tests/test_barrier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_proper_lowering(filter_str):
1919
def twice(A):
2020
i = dpex.get_global_id(0)
2121
d = A[i]
22-
dpex.barrier(dpex.CLK_LOCAL_MEM_FENCE) # local mem fence
22+
dpex.barrier(dpex.LOCAL_MEM_FENCE) # local mem fence
2323
A[i] = d * 2
2424

2525
N = 256
@@ -66,7 +66,7 @@ def reverse_array(A):
6666
# preload
6767
lm[i] = A[i]
6868
# barrier local or global will both work as we only have one work group
69-
dpex.barrier(dpex.CLK_LOCAL_MEM_FENCE) # local mem fence
69+
dpex.barrier(dpex.LOCAL_MEM_FENCE) # local mem fence
7070
# write
7171
A[i] += lm[blocksize - 1 - i]
7272

numba_dpex/tests/kernel_tests/test_private_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def private_memory_kernel(A):
1919
i = numba_dpex.get_global_id(0)
2020
prvt_mem = numba_dpex.private.array(shape=1, dtype=np.float32)
2121
prvt_mem[0] = i
22-
numba_dpex.barrier(numba_dpex.CLK_LOCAL_MEM_FENCE) # local mem fence
22+
numba_dpex.barrier(numba_dpex.LOCAL_MEM_FENCE) # local mem fence
2323
A[i] = prvt_mem[0] * 2
2424

2525
N = 64

0 commit comments

Comments
 (0)