Skip to content

Commit 67c7d06

Browse files
author
zhouwg
committed
ggml-hexagon: remove redundant code in struct ggml_backend_hexagon_buffer_context
1 parent 88acf6d commit 67c7d06

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

ggml/src/ggml-hexagon/ggml-hexagon.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ class hexagon_profiler {
901901
_profiler_threshold_duration = profiler_threshold_duration;
902902
_profiler_threshold_counts = profiler_threshold_counts;
903903

904-
//FIXME:hardcode filename of profiler data
905904
std::string filename = std::string(g_hexagon_appcfg.runtime_libpath) + "/";
906905
if (HWACCEL_CDSP == g_hexagon_appcfg.hwaccel_approach) {
907906
if (g_hexagon_appcfg.thread_counts > 1) {
@@ -5763,19 +5762,12 @@ struct ggml_backend_hexagon_buffer_context {
57635762
ggml_aligned_free(buffer, 0);
57645763
}
57655764
}
5766-
5767-
for (auto * sub_buffer : sub_buffers) {
5768-
free(sub_buffer);
5769-
}
5770-
5771-
sub_buffers.clear();
57725765
}
5766+
57735767
void * buffer = nullptr;
5768+
size_t buffer_size = 0;
57745769

57755770
struct ggml_backend_hexagon_context * backend_ctx = nullptr;
5776-
5777-
size_t buffer_size = 0;
5778-
std::vector<void *> sub_buffers;
57795771
};
57805772

57815773
static void ggml_backend_hexagon_buffer_free_buffer(ggml_backend_buffer_t buffer) {
@@ -5895,9 +5887,17 @@ static ggml_backend_buffer_t ggml_backend_hexagon_buffer_type_alloc_buffer(
58955887
return ggml_backend_buffer_init(buft, ggml_backend_hexagon_buffer_interface, buffer_ctx, size);
58965888
}
58975889

5890+
/**
5891+
* @param buft pointer to the buffer type context
5892+
* @return alignment requirement in bytes
5893+
*/
58985894
static size_t ggml_backend_hexagon_buffer_type_get_alignment(ggml_backend_buffer_type_t buft) {
58995895
GGML_UNUSED(buft);
5900-
return 32;
5896+
if ((HWACCEL_CDSP == g_hexagon_appcfg.hwaccel_approach) && (1 == g_hexagon_appcfg.enable_rpc_ion_mempool)) {
5897+
return 128;
5898+
} else {
5899+
return 32;
5900+
}
59015901
}
59025902

59035903
static size_t ggml_backend_hexagon_buffer_type_get_max_size(ggml_backend_buffer_type_t buft) {
@@ -5919,11 +5919,7 @@ static bool ggml_backend_buft_is_hexagon(ggml_backend_buffer_type_t buft) {
59195919
static bool ggml_backend_hexagon_buffer_is_host(ggml_backend_buffer_type_t buft) {
59205920
struct ggml_backend_hexagon_context * ctx = static_cast<ggml_backend_hexagon_context *>(buft->context);
59215921
GGML_ASSERT(nullptr != ctx);
5922-
if ((HWACCEL_CDSP == g_hexagon_appcfg.hwaccel_approach) && (1 == g_hexagon_appcfg.enable_rpc_ion_mempool)) {
5923-
//FIXME: return false here is make sense in this scenario although this is not key-point at the moment
5924-
// fix it after solving other urgent tasks
5925-
//return false;
5926-
}
5922+
GGML_UNUSED(ctx);
59275923
return true;
59285924
}
59295925

0 commit comments

Comments
 (0)