ioroDevice issue on multigpu system#135
Open
jpola-amd wants to merge 1 commit intoGPUOpen-LibrariesAndSDKs:mainfrom
Open
ioroDevice issue on multigpu system#135jpola-amd wants to merge 1 commit intoGPUOpen-LibrariesAndSDKs:mainfrom
jpola-amd wants to merge 1 commit intoGPUOpen-LibrariesAndSDKs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix UB type-punning in
ioroDeviceand packed device handle boundariesReplace the
ioroDevicebitfield struct with a singleoroU32 m_valuerepresentation. The old constructor wrote through anint*alias over bitfield storage, which is undefined behaviour under the strict aliasing rule and also relied on unspecified bitfield layout.The old
oroSetRawDeviceadditionally misinterpreted a raw backend device index as an already-packed Orochi handle, causing incorrect results for any device index with bits overlapping the API field (e.g.oroDevice = 1). This appears when testing HIPRT with HIP_VISIBLE_DEVICES="1".Changes:
ioroDevicenow stores a singleoroU32; API and device index are packed/unpacked with explicit masks and shifts. API field widened from 4 to 5 bits to cover the fulloroApienum includingORO_API_CUDARTC = 1 << 4.oroSetRawDevicepacks from zero, so the raw device index is written into the correct field rather than being misread as packed data.oroDeviceboundary sites (oroDeviceGet,oroGetRawDevice,oroGetDeviceProperties,oroDeviceGetName,oroDeviceGetAttribute,oroCtxCreate) replace*(ioroDevice*)device = dand*(oroDevice*)&dcasts with plain(oroDevice)d.packed()/ioroDevice((oroU32)dev)conversions.