Code used for blog articles
Webpages:
Code used for blog articles
License: MIT License
Code used for blog articles
Webpages:
Hi Juan,
Thanks for the articles and source on getting started with Level Zero.
I noticed that you time your GPU execution from zeCommandListClose
to zeCommandQueueSynchronize
.
I think a more accurate timing would be to measure from zeCommandQueueExecuteCommandLists
with a fence to zeFenceHostSynchronize
(see example here).
I've only just started to look at Level Zero and I'm not even familiar with Vulkan, but IIUC zeCommandQueueSynchronize
just guarantees that the command queue has 'shipped' and is ready for reuse. It does not guarantee that execution on the GPU has completed.
I noticed that host-synchronizing on an event without synchronizing the command queue first gives an error. So I'm a little surprised about the example linked above which does not seem to require queue synchronization for fences.
Thank you for the write up. In your article, when you initialize Level Zero structures, you do not initialize certain fields. in particular, pnext
as shown here:
ze_context_desc_t contextDescription = {};
contextDescription.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
contextDescription.flags = 0;
Intel compilers initialize them to 0 by default, whereas clang does not resulting in jumps based on uninitialized values and your samples crashing/hangning every now and then.
Fix:
ze_context_desc_t contextDescription = {};
contextDescription.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
contextDescription.flags = 0;
contextDescription.pNext = nullptr;
// from mxm.cpp
VALIDATECALL(zeKernelSetArgumentValue(kernel, 0, sizeof(dstResult), &dstResult));
VALIDATECALL(zeKernelSetArgumentValue(kernel, 1, sizeof(sharedA), &sharedA));
VALIDATECALL(zeKernelSetArgumentValue(kernel, 2, sizeof(sharedB), &sharedB));
VALIDATECALL(zeKernelSetArgumentValue(kernel, 3, sizeof(int), &items));
doesn't correspond to
// from matrixMultiply.cl
__kernel void mxm(__global int* a, __global int* b, __global int *c, const int n) {
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.