Skip to content

Commit

Permalink
Merge branch 'master' into hunyuan_model
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohb authored Jan 3, 2025
2 parents 674ddf1 + 548786a commit 5eb103c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/frontends/jax/src/op_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "openvino/op/not_equal.hpp"
#include "openvino/op/reduce_max.hpp"
#include "openvino/op/reduce_sum.hpp"
#include "openvino/op/sigmoid.hpp"
#include "openvino/op/sqrt.hpp"
#include "openvino/op/subtract.hpp"
#include "openvino/op/tanh.hpp"
Expand Down Expand Up @@ -94,6 +95,7 @@ const std::map<std::string, CreatorFunction> get_supported_ops_jaxpr() {
{"rsqrt", op::translate_rsqrt},
{"reshape", op::translate_reshape},
{"select_n", op::translate_select_n},
{"logistic", op::translate_1to1_match_1_input<v0::Sigmoid>},
{"slice", op::translate_slice},
{"square", op::translate_square},
{"sqrt", op::translate_1to1_match_1_input<v0::Sqrt>},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class ExecutionConfig {
void apply_performance_hints(const cldnn::device_info& info);
void apply_priority_hints(const cldnn::device_info& info);
void apply_debug_options(const cldnn::device_info& info);
void update_specific_default_properties(const cldnn::device_info& info);

template <typename T, PropertyMutability mutability>
void apply_rt_info_property(const ov::Property<T, mutability>& property, const ov::RTMap& rt_info) {
Expand All @@ -167,6 +168,8 @@ class ExecutionConfig {

std::map<std::string, PropertyVisibility> supported_properties;
std::map<std::string, BaseValidator::Ptr> property_validators;

bool specific_default_properties_is_set = false;
};

} // namespace intel_gpu
Expand Down
30 changes: 20 additions & 10 deletions src/plugins/intel_gpu/src/runtime/execution_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,27 @@ void ExecutionConfig::apply_hints(const cldnn::device_info& info) {
apply_debug_options(info);
}

void ExecutionConfig::update_specific_default_properties(const cldnn::device_info& info) {
// These default properties should be set once.
if (specific_default_properties_is_set)
return;
specific_default_properties_is_set = true;

// Enable KV-cache compression by default for non-systolic platforms
if (get_property(ov::hint::kv_cache_precision) == ov::element::undefined && !info.supports_immad) {
set_property(ov::hint::kv_cache_precision(ov::element::i8));
}

// Enable dynamic quantization by default for non-systolic platforms
if (get_property(ov::hint::dynamic_quantization_group_size) == 0 && !info.supports_immad) {
set_property(ov::hint::dynamic_quantization_group_size(32));
}
}

void ExecutionConfig::apply_user_properties(const cldnn::device_info& info) {
// Update specific default properties, call once before internal_properties updated.
update_specific_default_properties(info);

// Copy internal properties before applying hints to ensure that
// a property set by hint won't be overriden by a value in user config.
// E.g num_streams=AUTO && hint=THROUGHPUT
Expand All @@ -249,16 +269,6 @@ void ExecutionConfig::apply_user_properties(const cldnn::device_info& info) {
set_property(ov::intel_gpu::queue_type(QueueTypes::in_order));
}

// Enable KV-cache compression by default for non-systolic platforms
if (!is_set_by_user(ov::hint::kv_cache_precision) && !info.supports_immad) {
set_property(ov::hint::kv_cache_precision(ov::element::i8));
}

// Enable dynamic quantization by default for non-systolic platforms
if (!is_set_by_user(ov::hint::dynamic_quantization_group_size) && !info.supports_immad) {
set_property(ov::hint::dynamic_quantization_group_size(32));
}

user_properties.clear();
}

Expand Down
37 changes: 37 additions & 0 deletions tests/layer_tests/jax_tests/test_logistic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import jax
import numpy as np
import pytest
from jax import numpy as jnp

from jax_layer_test_class import JaxLayerTest

rng = np.random.default_rng(5402)


class TestLogistic(JaxLayerTest):
def _prepare_input(self):

input = jnp.array(np.random.uniform(-1000, 1000, self.input_shape).astype(self.input_type))
return [input]

def create_model(self, input_shape, input_type):
self.input_shape = input_shape
self.input_type = input_type

def jax_logistic(input):
return jax.lax.logistic(input)

return jax_logistic, None, 'logistic'

@pytest.mark.parametrize("input_shape", [[2], [3, 4], [5,6,7]])
@pytest.mark.parametrize("input_type", [np.float32, np.float64])
@pytest.mark.nightly
@pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_logistic(self, ie_device, precision, ir_version, input_shape, input_type):
self._test(*self.create_model(input_shape, input_type),
ie_device, precision,
ir_version)

0 comments on commit 5eb103c

Please sign in to comment.