presets.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // MIT license
  3. // Copyright (C) 2024 Intel Corporation
  4. // SPDX-License-Identifier: MIT
  5. //
  6. //
  7. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  8. // See https://llvm.org/LICENSE.txt for license information.
  9. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  10. //
  11. #ifndef GGML_SYCL_PRESETS_HPP
  12. #define GGML_SYCL_PRESETS_HPP
  13. #define GGML_SYCL_MAX_STREAMS 8
  14. #define GGML_SYCL_MAX_BUFFERS 256
  15. #define GGML_SYCL_MAX_DEVICES 48
  16. #define GGML_SYCL_NAME "SYCL"
  17. #define WARP_SIZE 32
  18. #define MATRIX_ROW_PADDING 512 // last row of quant. matrices is a multiple of this to avoid out-of-bounds memory accesses
  19. #define SYCL_GELU_BLOCK_SIZE 256
  20. #define SYCL_SILU_BLOCK_SIZE 256
  21. #define SYCL_TANH_BLOCK_SIZE 256
  22. #define SYCL_RELU_BLOCK_SIZE 256
  23. #define SYCL_HARDSIGMOID_BLOCK_SIZE 256
  24. #define SYCL_HARDSWISH_BLOCK_SIZE 256
  25. #define SYCL_SQR_BLOCK_SIZE 256
  26. #define SYCL_CPY_BLOCK_SIZE 32
  27. #define SYCL_SCALE_BLOCK_SIZE 256
  28. #define SYCL_CLAMP_BLOCK_SIZE 256
  29. #define SYCL_ROPE_BLOCK_SIZE 256
  30. #define SYCL_ALIBI_BLOCK_SIZE 32
  31. #define SYCL_DIAG_MASK_INF_BLOCK_SIZE 32
  32. #define SYCL_QUANTIZE_BLOCK_SIZE 256
  33. #define SYCL_DEQUANTIZE_BLOCK_SIZE 256
  34. #define SYCL_GET_ROWS_BLOCK_SIZE 256
  35. #define SYCL_UPSCALE_BLOCK_SIZE 256
  36. #define SYCL_CONCAT_BLOCK_SIZE 256
  37. #define SYCL_PAD_BLOCK_SIZE 256
  38. #define SYCL_ACC_BLOCK_SIZE 256
  39. #define SYCL_IM2COL_BLOCK_SIZE 256
  40. #define SYCL_POOL2D_BLOCK_SIZE 256
  41. // dmmv = dequantize_mul_mat_vec
  42. #ifndef GGML_SYCL_DMMV_X
  43. #define GGML_SYCL_DMMV_X 32
  44. #endif
  45. #ifndef GGML_SYCL_MMV_Y
  46. #define GGML_SYCL_MMV_Y 1
  47. #endif
  48. #ifndef K_QUANTS_PER_ITERATION
  49. #define K_QUANTS_PER_ITERATION 2
  50. #else
  51. static_assert(K_QUANTS_PER_ITERATION == 1 || K_QUANTS_PER_ITERATION == 2, "K_QUANTS_PER_ITERATION must be 1 or 2");
  52. #endif
  53. #ifndef GGML_SYCL_PEER_MAX_BATCH_SIZE
  54. #define GGML_SYCL_PEER_MAX_BATCH_SIZE 128
  55. #endif // GGML_SYCL_PEER_MAX_BATCH_SIZE
  56. #define MUL_MAT_SRC1_COL_STRIDE 128
  57. #endif // GGML_SYCL_PRESETS_HPP