rocBLAS icon indicating copy to clipboard operation
rocBLAS copied to clipboard

[Feature]: allow data to be nullptr when querying for workspace buffer size

Open jakub-homola opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

I am querying the required workspace buffer size for manual workspace management using rocblas_start_device_memory_size_query and rocblas_stop_device_memory_size_query. When calling the rocblas functions inside the query, they require the matrix/vector pointers to be non-null. IMO, they should be allowed to be null, since they should not be used. Currently, the rocblas routine returns with rocblas_status_invalid_pointer. I am mainly using the trsm function, but this issue probably applies to all functions.

Describe the solution you'd like

Check matrix and vector pointers only if handle->is_device_memory_size_query() is false.

Describe alternatives you've considered

Passing e.g. (double*)(sizeof(double)) as the pointer argument works, but is clunky and weird.

Additional context

I need to do all allocations at one place, therefore cannot first allocate the matrix, then query workspace size, and then do another allocation of the workspace buffer.

Library context

I am using rocblas that comes with rocm-5.4.3, but I see the same code handling the errors in the newest rocm-6.0.2 too.

jakub-homola avatar Feb 05 '24 13:02 jakub-homola

Dear friends, how to assign 1 to alpha and beta in rocblas_half alpha,beta?

xiaobo1025 avatar Feb 22 '24 02:02 xiaobo1025

@xiaobo1025 , could you refer to https://github.com/ROCm/rocBLAS-Examples. if you still have questions, please open a new issues, as this is unrelated to the current one. Thanks

rkamd avatar Mar 08 '24 15:03 rkamd

@jakub-homola , Thanks for requesting the feature, we are working on improving the workspace query. I will update the ticket with additional information once the requested feature is implemented.

rkamd avatar Mar 08 '24 15:03 rkamd

@jakub-homola ,

All the rocblas functions will now skip pointer checks during device memory size query. Changes are merged to develop, commits https://github.com/ROCm/rocBLAS/commit/70c6c5f665a975cb9a633187aed581934d79cee7 and https://github.com/ROCm/rocBLAS/commit/2614a2134a768cad6a69025e3bd939eb58a3a352

If this resolves the issue, please close the ticket.

rkamd avatar Mar 18 '24 18:03 rkamd

Seems ok at first sight, thanks :)

jakub-homola avatar Mar 18 '24 18:03 jakub-homola