Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static std::vector<llama_token> * g_output_tokens;
static bool is_interacting = false;
static bool need_insert_eot = false;


static void print_usage(int argc, char ** argv) {
(void) argc;

Expand Down
2 changes: 1 addition & 1 deletion ggml/src/ggml-tsavorite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ message(STATUS "Tsavorite framework is found")
#
# tsavorite Kernel Library
file(GLOB TLIBS "${RUNTIME_DIR}/lib/*.so" "../../${GGML_TSI_KERNEL_DIR}/host/*.o")

add_compile_options(--std=c++20)
ggml_add_backend_library(ggml-tsavorite
ggml-tsavorite.cpp
)
Expand Down
21 changes: 18 additions & 3 deletions ggml/src/ggml-tsavorite/ggml-tsavorite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@
#include <inttypes.h>
#include <math.h>
#include <string>

#include <iostream>
#include "ggml-backend-impl.h"
#include "ggml-impl.h"
#include "ggml.h"
#include "HostShimCAPI.h"
#include "tsi-rt/utils/Profiler.h"

using namespace std;
namespace tsirt = ::tsi::runtime;


typedef struct _txe_device_t *txe_device_s;
typedef struct _txe_compute_pipeline_state_t *txe_compute_pipeline_state_s;
Expand Down Expand Up @@ -513,9 +519,12 @@ static struct ggml_backend_tsavorite_context *ggml_tsavorite_init(ggml_backend_d
if (tsi_log_setup() == false)
return NULL;

// TSI Run time Initalization
tsi_initialize(NUM_OF_TXES);
std::string mainProfilerName = "LLAMA SP Main ";
tsirt::utils::TSIProfiler::initialize();
tsirt::utils::TSIScopedProfiler mainProfiler(mainProfilerName);

// TSI Run time Initalization
tsi_initialize(NUM_OF_TXES, NULL);
// init context
struct ggml_backend_tsavorite_context *ctx = (struct ggml_backend_tsavorite_context *)calloc(
1, sizeof(struct ggml_backend_tsavorite_context));
Expand Down Expand Up @@ -614,6 +623,12 @@ static void ggml_tsavorite_free(struct ggml_backend_tsavorite_context *ctx) {
GGML_TSAVORITE_LOG_INFO("Delaying tsi_finalize for 2 sec");
sleep(2);
tsi_finalize();
tsirt::utils::TSIProfiler::finalize();
std::cout << "\nLLAMA SP Profiling Results:" << std::endl;
std::cout << tsirt::utils::TSIProfiler::getFormattedResults(
/*truncateFuncNames*/ true)
<< std::endl;
//tsi_finalize();
GGML_TSAVORITE_LOG_INFO("End %s\n", __func__);
}

Expand Down