-
Notifications
You must be signed in to change notification settings - Fork 794
[SYCL][ESIMD][EMU] Merging buffer/image info to surface info #5930
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
kbobrovs
merged 4 commits into
intel:sycl
from
dongkyunahn-intel:esimd_emu_surface_info_merge
May 2, 2022
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9cfabff
[SYCL][ESIMD][EMU] Merging buffer/image info to surface info
dongkyunahn-intel 9ca2466
Camel-type for surface type enum
dongkyunahn-intel 2bc6f54
Fixing constructor/destructor for _pi_object/_pi_mem
dongkyunahn-intel c1eebfc
Destructor for _pi_mem struct
dongkyunahn-intel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,27 @@ struct _pi_queue : _pi_object { | |
| cm_support::CmQueue *CmQueuePtr = nullptr; | ||
| }; | ||
|
|
||
| struct cm_surface_ptr_t { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add later comments what is this structure for. |
||
| // 'UP' means 'User-Provided' in CM Lib - corresponding to | ||
| // Buffer/Image created with PI_MEM_FLAGS_HOST_PTR_USE option in | ||
| // SYCL | ||
| enum SurfaceType { | ||
| type_none, | ||
dongkyunahn-intel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| type_regular_buffer, | ||
| type_user_provided_buffer, | ||
| type_regular_image, | ||
| type_user_provided_image | ||
| }; | ||
| SurfaceType tag = type_none; | ||
|
|
||
| union { | ||
| cm_support::CmBuffer *RegularBufPtr = nullptr; | ||
| cm_support::CmBufferUP *UPBufPtr; | ||
| cm_support::CmSurface2D *RegularImgPtr; | ||
| cm_support::CmSurface2DUP *UPImgPtr; | ||
| }; | ||
| }; | ||
|
|
||
| struct _pi_mem : _pi_object { | ||
| _pi_mem() = default; | ||
dongkyunahn-intel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
@@ -135,67 +156,32 @@ struct _pi_mem : _pi_object { | |
| // Supporing multi-threaded mapping/unmapping calls | ||
| std::mutex MappingsMutex; | ||
|
|
||
| _pi_mem_type getMemType() const { return MemType; }; | ||
| cm_surface_ptr_t SurfacePtr; | ||
|
|
||
| protected: | ||
| _pi_mem(pi_context ctxt, char *HostPtr, _pi_mem_type MemTypeArg, | ||
| _pi_mem(pi_context ctxt, char *HostPtr, cm_surface_ptr_t SurfacePtrArg, | ||
dongkyunahn-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| unsigned int SurfaceIdxArg) | ||
| : Context{ctxt}, MapHostPtr{HostPtr}, | ||
| SurfaceIndex{SurfaceIdxArg}, MemType{MemTypeArg} {} | ||
|
|
||
| private: | ||
| _pi_mem_type MemType; | ||
| }; | ||
|
|
||
| // TODO: Merge cm_buffer_ptr_slot and cm_image_ptr_slot into one | ||
| // struct | ||
| struct cm_buffer_ptr_slot { | ||
| // 'UP' means 'User-Provided' in CM Lib - corresponding to | ||
| // Host-created buffer in SYCL | ||
|
|
||
| enum type { type_none, type_regular, type_user_provided }; | ||
| type tag = type_none; | ||
|
|
||
| union { | ||
| cm_support::CmBuffer *RegularBufPtr = nullptr; | ||
| cm_support::CmBufferUP *UPBufPtr; | ||
| }; | ||
| }; | ||
|
|
||
| struct cm_image_ptr_slot { | ||
| // 'UP' means 'User-Provided' in CM Lib - corresponding to | ||
| // Host-created image in SYCL | ||
|
|
||
| enum type { type_none, type_regular, type_user_provided }; | ||
| type tag = type_none; | ||
|
|
||
| union { | ||
| cm_support::CmSurface2D *RegularImgPtr = nullptr; | ||
| cm_support::CmSurface2DUP *UPImgPtr; | ||
| }; | ||
| : Context{ctxt}, MapHostPtr{HostPtr}, SurfaceIndex{SurfaceIdxArg}, | ||
| SurfacePtr{SurfacePtrArg} {} | ||
| }; | ||
|
|
||
| struct _pi_buffer final : _pi_mem { | ||
| // Buffer/Sub-buffer constructor | ||
| _pi_buffer(pi_context ctxt, char *HostPtr, cm_buffer_ptr_slot BufferPtrArg, | ||
| _pi_buffer(pi_context ctxt, char *HostPtr, cm_surface_ptr_t SurfacePtrArg, | ||
| unsigned int SurfaceIdxArg, size_t SizeArg) | ||
| : _pi_mem(ctxt, HostPtr, PI_MEM_TYPE_BUFFER, SurfaceIdxArg), | ||
| BufferPtr{BufferPtrArg}, Size{SizeArg} {} | ||
| : _pi_mem(ctxt, HostPtr, SurfacePtrArg, SurfaceIdxArg), Size{SizeArg} {} | ||
|
|
||
| cm_buffer_ptr_slot BufferPtr; | ||
| size_t Size; | ||
| }; | ||
|
|
||
| struct _pi_image final : _pi_mem { | ||
| // Image constructor | ||
| _pi_image(pi_context ctxt, char *HostPtr, cm_image_ptr_slot ImagePtrArg, | ||
| _pi_image(pi_context ctxt, char *HostPtr, cm_surface_ptr_t SurfacePtrArg, | ||
| unsigned int SurfaceIdxArg, size_t WidthArg, size_t HeightArg, | ||
| size_t BPPArg) | ||
| : _pi_mem(ctxt, HostPtr, PI_MEM_TYPE_IMAGE2D, SurfaceIdxArg), | ||
| ImagePtr(ImagePtrArg), Width{WidthArg}, Height{HeightArg}, | ||
| BytesPerPixel{BPPArg} {} | ||
| : _pi_mem(ctxt, HostPtr, SurfacePtrArg, SurfaceIdxArg), Width{WidthArg}, | ||
| Height{HeightArg}, BytesPerPixel{BPPArg} {} | ||
|
|
||
| cm_image_ptr_slot ImagePtr; | ||
| size_t Width; | ||
| size_t Height; | ||
| size_t BytesPerPixel; | ||
|
|
||
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.
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 this functionality be encapsulated in destrutor of _pi_mem ?
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.
Done.