Skip to content
Merged
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
24 changes: 24 additions & 0 deletions onnxruntime/test/providers/openvino/openvino_ep_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "core/framework/provider_options.h"
#include "core/framework/tensor_shape.h"
#include "core/common/float16.h"
#include "core/common/cpuid_info.h"

Comment on lines 11 to 15
#include "test/util/include/test_utils.h"
#include "test/util/include/test/test_environment.h"
Expand All @@ -32,6 +33,17 @@ extern std::unique_ptr<Ort::Env> ort_env;

namespace {

// Returns true only on Intel CPUs.
//
// The OVIR EP context tests are gated on this because that path is currently
// validated only on Intel silicon. In particular, embed_mode = 0 dumps the
// compiled model to a separate .bin file and memory-maps it back on reload;
// this round-trip is unsupported on non-Intel CPUs (e.g. AMD), where it can
// crash. On those CPUs the OVIR EP context tests are skipped.
bool IsIntelCPU() {
return onnxruntime::CPUIDInfo::GetCPUIDInfo().GetCPUVendor() == "Intel";
}
Comment on lines +43 to +45

// Runs a mul_1-style model (X[3,2] -> Y[3,2], Y = X * {1,2,3,4,5,6}) with
// X = all 2.0f and validates that Y == {2,4,6,8,10,12}.
void RunAndValidate(Ort::Session& session) {
Expand Down Expand Up @@ -115,6 +127,12 @@ TEST_F(OVEPEPContextTests, OVEPEPContextFolderPath) {
// CPU only.
class OVEPEPContextOVIRTests : public ::testing::Test {
protected:
void SetUp() override {
if (!IsIntelCPU()) {
GTEST_SKIP() << "OVIR EP context is only validated on Intel CPUs; skipping on non-Intel silicon.";
}
}

static constexpr const char* kDevice = "CPU";
static constexpr const ORTCHAR_T* kOvirModelPath = ORT_TSTR("testdata/mul_1_ep_ctx_ovir.onnx");
};
Expand Down Expand Up @@ -221,6 +239,12 @@ TEST_F(OVEPEPContextOVIRTests, RejectsEpCacheContextPathTraversal) {
// CPU only. Parameter: embed_mode_enabled.
class OVEPOVIRModelsExportEPContextTests : public ::testing::TestWithParam<bool> {
protected:
void SetUp() override {
if (!IsIntelCPU()) {
GTEST_SKIP() << "OVIR EP context export is only validated on Intel CPUs; skipping on non-Intel silicon.";
}
}

static constexpr const char* kDevice = "CPU";
static constexpr const ORTCHAR_T* kOvirModelPath = ORT_TSTR("testdata/mul_1_ep_ctx_ovir.onnx");
};
Expand Down
Loading