55#include " SyclWrappedAPI.h"
66#include < iostream>
77
8+ #include " Internals.h"
9+
810using namespace device ;
11+ using namespace device ::internals;
912
1013void *ConcreteAPI::allocGlobMem (size_t size, bool compress) {
1114 auto *ptr = malloc_device (size, this ->currentDefaultQueue ());
1215 this ->currentStatistics ().allocatedMemBytes += size;
1316 this ->currentMemoryToSizeMap ().insert ({ptr, size});
14- this ->currentDefaultQueue (). wait ( );
17+ waitCheck ( this ->currentDefaultQueue ());
1518 return ptr;
1619}
1720
@@ -20,15 +23,15 @@ void *ConcreteAPI::allocUnifiedMem(size_t size, bool compress, Destination hint)
2023 this ->currentStatistics ().allocatedUnifiedMemBytes += size;
2124 this ->currentStatistics ().allocatedMemBytes += size;
2225 this ->currentMemoryToSizeMap ().insert ({ptr, size});
23- this ->currentDefaultQueue (). wait ( );
26+ waitCheck ( this ->currentDefaultQueue ());
2427 return ptr;
2528}
2629
2730void *ConcreteAPI::allocPinnedMem (size_t size, bool compress, Destination hint) {
2831 auto *ptr = malloc_host (size, this ->currentDefaultQueue ());
2932 this ->currentStatistics ().allocatedMemBytes += size;
3033 this ->currentMemoryToSizeMap ().insert ({ptr, size});
31- this ->currentDefaultQueue (). wait ( );
34+ waitCheck ( this ->currentDefaultQueue ());
3235 return ptr;
3336}
3437
@@ -45,7 +48,7 @@ void ConcreteAPI::freeMem(void *devPtr) {
4548 this ->currentStatistics ().deallocatedMemBytes += this ->currentMemoryToSizeMap ().at (devPtr);
4649 this ->currentMemoryToSizeMap ().erase (devPtr);
4750 free (devPtr, this ->currentDefaultQueue ().get_context ());
48- this -> currentDefaultQueue (). wait ( );
51+ waitCheck ( currentDefaultQueue ());
4952 }
5053}
5154
0 commit comments