diff --git a/src/models/debugging.cpp b/src/models/debugging.cpp index 491ba4cdbd..25ab24f177 100644 --- a/src/models/debugging.cpp +++ b/src/models/debugging.cpp @@ -1,5 +1,6 @@ #include "../generators.h" #include "debugging.h" +#include namespace Generators { static constexpr size_t c_value_count = 10; // Dump this many values from the start of a tensor @@ -26,7 +27,7 @@ void DumpValues(ONNXTensorElementDataType type, const void* p_values_raw, size_t case Ort::TypeToTensorType::type: { auto* p_values = reinterpret_cast(p_values_raw); for (size_t i = 0; i < count; i++) { - printf("%lld ", p_values[i]); + printf("%" PRId64 " ", p_values[i]); } break; } diff --git a/src/models/input_ids.cpp b/src/models/input_ids.cpp index a3e5d81fb7..7ee7129dbb 100644 --- a/src/models/input_ids.cpp +++ b/src/models/input_ids.cpp @@ -67,7 +67,7 @@ void InputIDs::Update(RoamingArray next_tokens_unk) { } } -template InputIDs; -template InputIDs; +template struct InputIDs; +template struct InputIDs; } // namespace Generators diff --git a/src/models/kv_cache.cpp b/src/models/kv_cache.cpp index 5c90d53c98..00e8d3b711 100644 --- a/src/models/kv_cache.cpp +++ b/src/models/kv_cache.cpp @@ -64,7 +64,7 @@ void KV_Cache_Combined::PickPastState(std::span beam_indices, int auto element_count = shape_[0] * past_key_size; const OrtValue& present = *presents_[index]; - auto past = OrtValue::CreateTensor(*model_.allocator_device_, shape_); + std::unique_ptr past = OrtValue::CreateTensor(*model_.allocator_device_, shape_); auto past_span = std::span(past->GetTensorMutableData(), element_count); auto present_span = std::span(present.GetTensorData(), element_count); @@ -179,7 +179,7 @@ void KV_Cache::PickPastState(std::span beam_indices, int index) { auto element_count = shape_[0] * block_size_per_beam; const OrtValue& present_value = *presents_[index]; - auto past_value = OrtValue::CreateTensor(*model_.allocator_device_, shape_); + std::unique_ptr past_value = OrtValue::CreateTensor(*model_.allocator_device_, shape_); auto past_span = std::span(past_value->GetTensorMutableData(), element_count); auto present_span = std::span(present_value.GetTensorData(), element_count); diff --git a/src/models/position_ids.cpp b/src/models/position_ids.cpp index b40e8e516a..7f1e896ada 100644 --- a/src/models/position_ids.cpp +++ b/src/models/position_ids.cpp @@ -100,7 +100,7 @@ void PositionIDs::Update(int current_length) { attention_mask_shape_[1] = current_length; const auto* old_data = attention_mask_->GetTensorData(); - auto attention_mask = OrtValue::CreateTensor(*model_.allocator_device_, attention_mask_shape_); + std::unique_ptr attention_mask = OrtValue::CreateTensor(*model_.allocator_device_, attention_mask_shape_); auto* data = attention_mask->GetTensorMutableData(); switch (model_.device_type_) { @@ -125,7 +125,7 @@ void PositionIDs::Update(int current_length) { } } -template PositionIDs; -template PositionIDs; +template struct PositionIDs; +template struct PositionIDs; } // namespace Generators diff --git a/src/ort_genai_c.h b/src/ort_genai_c.h index 2cd99b7e7e..713275c4fa 100644 --- a/src/ort_genai_c.h +++ b/src/ort_genai_c.h @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include +#include #ifdef __cplusplus extern "C" {