-
Notifications
You must be signed in to change notification settings - Fork 30
Level zero codegen #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Level zero codegen #250
Conversation
@oleksandr-pavlyk I made the change you suggested by dynamically opening |
Used # sasha_test.py
with open('dpctl/tests/input_files/multi_kernel.spv', 'br') as fh:
sprv_pr = fh.read()
import dpctl, dpctl.memory as dpmem, dpctl.program as dppro
import numpy as np
import ctypes
q = dpctl.get_current_queue()
pr = dppro.create_program_from_spirv(q, sprv_pr)
k = pr.get_sycl_kernel('axpy')
s = np.dtype('i4').itemsize
a = dpmem.MemoryUSMShared(1024 * s)
b = dpmem.MemoryUSMShared(1024 * s)
c = dpmem.MemoryUSMShared(1024 * s)
ha = np.arange(0, 1024, dtype='i4')
hb = np.arange(1024-1, -1, -1, dtype='i4')
hc = np.zeros(1024, dtype='i4')
a.copy_from_host(ha.view(dtype='|u1'))
b.copy_from_host(hb.view(dtype='|u1'))
c.copy_from_host(hc.view(dtype='|u1'))
ev = q.submit(k, [a, b, c, ctypes.c_int(3)], [1024])
ev.wait()
res = c.copy_to_host().view(dtype='i4')
print(np.array_equal(res, ha + 3*hb))
q.get_sycl_device().dump_device_info() Verified that
The test passed, outputting
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tried to build and run dpctl
on a machine without level-zero installed, say any older machine with older than Gen9 GPU.
Fixes few left over things from level zero changes.