ROCm/rocBLAS

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

jakub-homola opened this issue · 5 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.

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

@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

@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.

@jakub-homola ,

All the rocblas functions will now skip pointer checks during device memory size query.
Changes are merged to develop, commits 70c6c5f and 2614a21

If this resolves the issue, please close the ticket.

Seems ok at first sight, thanks :)