-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[GPU][PoC] Common shape info buffer #28167
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -903,9 +903,10 @@ class UsmHolder { | |
~UsmHolder() { | ||
memFree(); | ||
} | ||
|
||
void* _ptr; | ||
private: | ||
const cl::UsmHelper& _usmHelper; | ||
void* _ptr; | ||
bool _shared_memory = false; | ||
}; | ||
/* | ||
|
@@ -922,6 +923,10 @@ class UsmMemory { | |
} | ||
} | ||
|
||
void add_offset(size_t offsetPtr) const { | ||
_usm_pointer->_ptr = (void*) ((unsigned char*) _usm_pointer->_ptr + offsetPtr); | ||
} | ||
Comment on lines
+926
to
+928
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. Probably we shouldn't expose this function because it allows shifting the pointer of any UsmMemory. This pointer is also used for free_mem() call, and I'm not sure it will be properly handled if shifted accidently for the not-shared memory buffer. Maybe it would be better to limit shifting only with specialized c-tr like |
||
|
||
// Get methods returns original pointer allocated by openCL. | ||
void* get() const { return _usm_pointer->ptr(); } | ||
|
||
|
@@ -953,9 +958,9 @@ class UsmMemory { | |
} | ||
|
||
virtual ~UsmMemory() = default; | ||
const UsmHelper& _usmHelper; | ||
|
||
protected: | ||
const UsmHelper& _usmHelper; | ||
std::shared_ptr<UsmHolder> _usm_pointer = nullptr; | ||
|
||
private: | ||
|
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.
I think it's better to hold the pointer to the base buffer in the sub-buffer itself, thus their lifetimes will be better aligned