Skip to content

[SYCL][ESIMD][NFC] Fix namespace of ESIMD implementation details. #3487

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

Merged

Conversation

kbobrovs
Copy link
Contributor

@kbobrovs kbobrovs commented Apr 5, 2021

  • Move ESIMD API declarations that are implementaion details into
    sycl::INTEL::gpu::detail and sycl::INTEL::gpu::emu::detail
    namespaces.

  • Make enum { BYTE = 1, WORD = 2, ..., GRF = 32 } local to a struct
    to avoid global namespace pollution.

  • Relocate AccessorPrivateProxy to memory intrinsics header(s) where
    it is only supposed to be used.

  • get rid of extra __esimd namespace

Signed-off-by: Konstantin S Bobrovsky [email protected]

- Move ESIMD API declarations that are implementaion details into
sycl::INTEL::gpu::detail and sycl::INTEL::gpu::emu::detail
namespaces.

- Make enum { BYTE = 1, WORD = 2, ..., GRF = 32 } local to a struct
to avoid global namespace pollution.

- Relocate AccessorPrivateProxy to memory intrinsics header(s) where
it is only supposed to be used.

Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs kbobrovs requested review from DenisBakhvalov and a team as code owners April 5, 2021 02:41
@kbobrovs kbobrovs requested a review from v-klochkov April 5, 2021 02:41
/// Constant in number of bytes.
enum { BYTE = 1, WORD = 2, DWORD = 4, QWORD = 8, OWORD = 16, GRF = 32 };
/// ESIMD intrinsic operand size in bytes.
struct OperandSize {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe enum class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OperandSize::member can be conveniently used as integer w/o static_cast, hence I did not add class


#include <assert.h>
#include <cstdint>

#define __SIGD sycl::INTEL::gpu::detail
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little concerned about the name here. Maybe something like this would be better?

namespace sigd = sycl::INTEL::gpu::detail;

Similar to what we have for csd namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the problem with such short names in headers in the global namespace is that they can conflict with other code. {{__}} factors out user code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's true. Do you know if we have project guidelines for such cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only guideline I know is the llvm coding style.

Copy link
Contributor Author

@kbobrovs kbobrovs Apr 5, 2021

Choose a reason for hiding this comment

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

The reason why I did not use namespace __SIGD = sycl::INTEL::gpu::detail; instead is because it is in the global scope and can't be undef'ed, unlike a macro. Which means all subsequent headers and user code will see that declaration. With macro, I just #undef it once no longer needed.

@kbobrovs kbobrovs requested a review from kychendev April 5, 2021 17:45
v-klochkov
v-klochkov previously approved these changes Apr 5, 2021
Copy link
Contributor

@v-klochkov v-klochkov left a comment

Choose a reason for hiding this comment

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

Looks good to me. I could not find any functional changes. There are no any, right?
If yes, then please add '[NFC]' to the commit title

@v-klochkov
Copy link
Contributor

If yes, then please add '[NFC]' to the commit title

Two tests failed and need your attention.

Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs kbobrovs changed the title [SYCL][ESIMD] Fix namespace of ESIMD implementation details. [SYCL][ESIMD][NFC] Fix namespace of ESIMD implementation details. Apr 5, 2021
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
@kbobrovs
Copy link
Contributor Author

kbobrovs commented Apr 5, 2021

Looks good to me. I could not find any functional changes. There are no any, right?
If yes, then please add '[NFC]' to the commit title

Right, added

@kbobrovs
Copy link
Contributor Author

kbobrovs commented Apr 5, 2021

If yes, then please add '[NFC]' to the commit title

Two tests failed and need your attention.

yes, fixed

@kbobrovs kbobrovs merged commit 9da3104 into intel:sycl Apr 6, 2021
@kbobrovs kbobrovs deleted the kbobrovs-esimd0-fix-impl-details-scope branch November 25, 2021 05:17
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.

3 participants