-
Notifications
You must be signed in to change notification settings - Fork 803
[SYCL] Always let the backend choose the binary #1587
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
Changes from 4 commits
bee1066
b7d6c64
86eb1e9
a18ddcd
4ef3f91
3627035
b3ebb95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -665,9 +665,13 @@ void ProgramManager::populateSpecConstRegistry() { | |
| RTDeviceBinaryImage &ProgramManager::getDeviceImage(OSModuleHandle M, | ||
| KernelSetId KSId, | ||
| const context &Context) { | ||
| if (DbgProgMgr > 0) | ||
| if (DbgProgMgr > 0) { | ||
| std::cerr << ">>> ProgramManager::getDeviceImage(" << M << ", \"" << KSId | ||
| << "\", " << getRawSyclObjImpl(Context) << ")\n"; | ||
|
|
||
| std::cerr << "available device images:\n"; | ||
| debugPrintBinaryImages(); | ||
| } | ||
| std::lock_guard<std::mutex> Guard(Sync::getGlobalLock()); | ||
| std::vector<RTDeviceBinaryImageUPtr> &Imgs = *m_DeviceImages[KSId]; | ||
| const ContextImplPtr Ctx = getSyclObjImpl(Context); | ||
|
|
@@ -680,19 +684,15 @@ RTDeviceBinaryImage &ProgramManager::getDeviceImage(OSModuleHandle M, | |
|
|
||
| // Ask the native runtime under the given context to choose the device image | ||
| // it prefers. | ||
| if (Imgs.size() > 1) { | ||
| std::vector<pi_device_binary> RawImgs(Imgs.size()); | ||
| for (unsigned I = 0; I < Imgs.size(); I++) | ||
| RawImgs[I] = const_cast<pi_device_binary>(&Imgs[I]->getRawData()); | ||
| std::vector<pi_device_binary> RawImgs(Imgs.size()); | ||
| for (unsigned I = 0; I < Imgs.size(); I++) | ||
| RawImgs[I] = const_cast<pi_device_binary>(&Imgs[I]->getRawData()); | ||
|
|
||
| Ctx->getPlugin().call<PiApiKind::piextDeviceSelectBinary>( | ||
| getFirstDevice(Ctx), RawImgs.data(), (cl_uint)RawImgs.size(), &ImgInd); | ||
| } | ||
| Ctx->getPlugin().call<PiApiKind::piextDeviceSelectBinary>( | ||
| getFirstDevice(Ctx), RawImgs.data(), (cl_uint)RawImgs.size(), &ImgInd); | ||
| Img = Imgs[ImgInd].get(); | ||
|
|
||
| if (DbgProgMgr > 0) { | ||
| std::cerr << "available device images:\n"; | ||
| debugPrintBinaryImages(); | ||
| std::cerr << "selected device image: " << &Img->getRawData() << "\n"; | ||
| Img->print(); | ||
| } | ||
|
|
@@ -994,7 +994,6 @@ DynRTDeviceBinaryImage::DynRTDeviceBinaryImage( | |
| Bin = new pi_device_binary_struct(); | ||
| Bin->Version = PI_DEVICE_BINARY_VERSION; | ||
| Bin->Kind = PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL; | ||
| Bin->DeviceTargetSpec = PI_DEVICE_BINARY_TARGET_UNKNOWN; | ||
| Bin->CompileOptions = ""; | ||
| Bin->LinkOptions = ""; | ||
| Bin->ManifestStart = nullptr; | ||
|
|
@@ -1004,6 +1003,15 @@ DynRTDeviceBinaryImage::DynRTDeviceBinaryImage( | |
| Bin->EntriesBegin = nullptr; | ||
| Bin->EntriesEnd = nullptr; | ||
| Bin->Format = pi::getBinaryImageFormat(Bin->BinaryStart, DataSize); | ||
|
|
||
| switch(Bin->Format) { | ||
| case PI_DEVICE_BINARY_TYPE_SPIRV: | ||
| Bin->DeviceTargetSpec = PI_DEVICE_BINARY_TARGET_SPIRV64; | ||
| break; | ||
| default: | ||
| Bin->DeviceTargetSpec = PI_DEVICE_BINARY_TARGET_UNKNOWN; | ||
| } | ||
|
||
|
|
||
| init(Bin); | ||
| } | ||
|
|
||
|
|
||
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.
Could help when filtering the output...
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.
actually i just moved this part up because it might be unreachable at it's old place.
If i were to improve those messages i would query for PI_TRACE at runtime instead? what do you think?
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.
That would be even better
Uh oh!
There was an error while loading. Please reload this page.
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.
@kbobrovs should i replace all
DbgProgMgrchecks with pi_trace in programmanager?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.
@hiaselhans , sorry for delay. Yes, definitely makes sense. Can be done as a separate PR.