ggml icon indicating copy to clipboard operation
ggml copied to clipboard

Fix #292

Open goerch opened this issue 2 years ago • 4 comments

Start of this edit. Would like to get some guidance on how to proceed...

Remarks:

  • Checked with clang on Windows 11 for unused variables in release configuration
  • There are probably some differences in debug and release configuration due to the usage of assert
  • Can't check Accelerate
  • Not sure if I'm able to test OpenCL
  • Definitely can't test CUDA

goerch avatar Jun 26 '23 18:06 goerch

Not sure if @ggerganov agrees, but I think that the best way to do this may be a simple macro that has all the variables for the 3 tensors src0/src1/dst, with casts to void (like the UNUSED macro) to silence unused warnings. I trust in the compiler's ability to remove actually unused variables. No need to complicate it.

slaren avatar Jun 26 '23 18:06 slaren

Not sure if @ggerganov agrees, but I think that the best way to do this may be a simple macro that has all the variables for the 3 tensors src0/src1/dst, with casts to void (like the UNUSED macro) to silence unused warnings. I trust in the compiler's ability to remove actually unused variables. No need to complicate it.

Thanks, then I'd tend to add the UNUSED macro to GGML_DEFINE_LOCALS.

goerch avatar Jun 26 '23 18:06 goerch

Yes, what @slaren said - let's always unpack all 4 array elements of ne and nb to simplify. Also, add an extra macro to unpack src0, src1 and dst all at once since this case is very commonly used

ggerganov avatar Jun 27 '23 07:06 ggerganov

The changes in ggml.c look reasonable to me. Do you want me to touch other files of the code base, too?

goerch avatar Jun 27 '23 11:06 goerch