diff --git a/docs/capture_single_kernels.md b/docs/capture_single_kernels.md index d6a03a36..039dc705 100644 --- a/docs/capture_single_kernels.md +++ b/docs/capture_single_kernels.md @@ -54,13 +54,16 @@ If the buffers don't agree, it will show a message in the terminal. * Device only buffers, i.e. those with `CL_MEM_HOST_NO_ACCESS`. When kernel capture is enabled, any device-only access flags are removed. * OpenCL Images * 2D, and 3D images are supported. +* OpenCL SVM and USM + * Pointers to the base of an SVM or USM allocation are supported. * OpenCL Samplers * OpenCL Kernels from source or IL * OpenCL Kernels from device binary ## Limitations (incomplete) -* Does not work with OpenCL SVM or USM. +* Does not work with pointers to the middle of an OpenCL SVM or USM allocation. +* Does not work with SVM or USM indirect access, where the SVM or USM allocation is not set as a kernel argument. * Does not work with OpenCL pipes. * Untested for out-of-order queues. * Sub-buffers are not dealt with explicitly, this may affect the results for both debugging and performance. diff --git a/intercept/scripts/run.py b/intercept/scripts/run.py index 8e4dccb3..27a91794 100644 --- a/intercept/scripts/run.py +++ b/intercept/scripts/run.py @@ -162,8 +162,10 @@ def sampler_from_string(ctx, sampler_descr): try: prg = cl.Program(ctx, [device], [binaries[idx]]).build(options) getattr(prg, kernel_name) + print(f"Successfully loaded kernel device binary file: {binary_files[idx]}") break except Exception as e: + print(f"Failed to load kernel device binary file: {binary_files[idx]}") pass kernel = getattr(prg, kernel_name) diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 5fc1cce5..3361464f 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -7706,6 +7706,16 @@ void CLIntercept::setKernelArgSVMPointer( CArgMemMap& argMemMap = m_KernelArgMemMap[ kernel ]; argMemMap[ arg_index ] = startPtr; } + + // Currently, only pointers to the start of an SVM allocation are supported for + // capture and replay. + if( arg == startPtr ) + { + CArgDataMap& argDataMap = m_KernelArgDataMap[kernel]; + const uint8_t* pRawArgData = reinterpret_cast(&arg); + argDataMap[ arg_index ] = std::vector( + pRawArgData, pRawArgData + sizeof(void*) ); + } } /////////////////////////////////////////////////////////////////////////////// @@ -7736,6 +7746,16 @@ void CLIntercept::setKernelArgUSMPointer( CArgMemMap& argMemMap = m_KernelArgMemMap[ kernel ]; argMemMap[ arg_index ] = startPtr; } + + // Currently, only pointers to the start of an SVM allocation are supported for + // capture and replay. + if( arg == startPtr ) + { + CArgDataMap& argDataMap = m_KernelArgDataMap[kernel]; + const uint8_t* pRawArgData = reinterpret_cast(&arg); + argDataMap[ arg_index ] = std::vector( + pRawArgData, pRawArgData + sizeof(void*) ); + } } ///////////////////////////////////////////////////////////////////////////////