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

[SYCL] Treat "ar" image format as PI_DEVICE_BINARY_TYPE_NATIVE #12587

Merged
merged 9 commits into from
Feb 5, 2024

Conversation

aelovikov-intel
Copy link
Contributor

That's what AOT for Intel GPUs produces when targeting multiple devices
at once.

This PR is built on top of #12586.

A future PR will add support for magic numbers other than four bytes.
Refactor the code to make those future changes easier to review.
That's what AOT for Intel GPUs produces when targeting multiple devices
at once.
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, especially with the following changes coming. Few nits.

Comment on lines 689 to 691
if (ImgSize < sizeof(Number))
return false;
return std::memcmp(ImgData, &Number, sizeof(Number)) == 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but I am not a huge fan of manual short-circuiting.

Suggested change
if (ImgSize < sizeof(Number))
return false;
return std::memcmp(ImgData, &Number, sizeof(Number)) == 0;
return ImgSize >= sizeof(Number) && std::memcmp(ImgData, &Number, sizeof(Number)) == 0;

// Check for ELF format, size requirements include data we'll read in case of
// succesful match.
if (ImgSize < 18 || !MatchMagicNumber(uint32_t{0x464c457F}))
return PI_DEVICE_BINARY_TYPE_NONE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Though I am generally against nested nesting, a case like this I would rather we do the ELF header checks inside the if. It means when someone want to add more binary type detection, they don't have to realize that at this point we assume the remaining binary types must be ELF.

@steffenlarsen
Copy link
Contributor

I just realized I reviewed the wrong PR. Alas, the changes can be applied to #12586.

@aelovikov-intel aelovikov-intel marked this pull request as ready for review February 2, 2024 18:18
@aelovikov-intel aelovikov-intel requested a review from a team as a code owner February 2, 2024 18:18
Copy link
Contributor

github-actions bot commented Feb 2, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

//
// -Xsycl-target-backend=spir64_gen "-device acm-g10,acm-g11"
//
// option.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit; I would prefer to have the comment outside the loop as having it inside the loop without brackets makes it hard to read... Unless you're used to Python code. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll keep as-is as it matches surrounding code better.

@aelovikov-intel aelovikov-intel merged commit 5b3ba9f into intel:sycl Feb 5, 2024
12 checks passed
@aelovikov-intel aelovikov-intel deleted the support-ar-as-native branch February 5, 2024 16:30
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

Successfully merging this pull request may close these issues.

2 participants