Skip to content
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

Union of elements of oroApi is not oroApi #98

Open
yusuke-tokuyoshi opened this issue Dec 12, 2024 · 0 comments
Open

Union of elements of oroApi is not oroApi #98

yusuke-tokuyoshi opened this issue Dec 12, 2024 · 0 comments

Comments

@yusuke-tokuyoshi
Copy link

Orochi/Orochi/Orochi.h

Lines 1170 to 1179 in c10d592

enum oroApi
{
ORO_API_AUTOMATIC = 1<<0,
ORO_API_HIPDRIVER = 1 << 1,
ORO_API_HIPRTC = 1 << 2,
ORO_API_HIP = ORO_API_HIPDRIVER | ORO_API_HIPRTC,
ORO_API_CUDADRIVER = 1 << 3,
ORO_API_CUDARTC = 1 << 4,
ORO_API_CUDA = ORO_API_CUDADRIVER | ORO_API_CUDARTC,
};

The union of oroApi is not an element of oroApi. But the current API deign forces us to cast the union to oroApi as follows:
https://github.com/amdadvtech/Rtb/blob/3e57c201b7459c40c291c9caa03f4dce95b9d650/Rtb/Device.cpp#L88-L89
For this case, The Clang analyzer can detect the out of range for oroApi and warns. To avoid such warnings, it may be better to change the Orochi's function parameter from oroApi to uint32_t, or it may be better to add ORO_API_ALL = 0xFFFFFFFF in oroApi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant