|
24 | 24 | #include "openvino/op/mvn.hpp"
|
25 | 25 | #include "openvino/op/normalize_l2.hpp"
|
26 | 26 | #include "openvino/op/power.hpp"
|
| 27 | +#include "openvino/op/random_uniform.hpp" |
27 | 28 | #include "openvino/op/range.hpp"
|
28 | 29 | #include "openvino/op/reduce_max.hpp"
|
29 | 30 | #include "openvino/op/reduce_mean.hpp"
|
|
42 | 43 | #include "openvino/op/unsqueeze.hpp"
|
43 | 44 | #include "openvino/op/util/broadcast_base.hpp"
|
44 | 45 | #include "openvino/op/util/pad_base.hpp"
|
| 46 | +#include "openvino/op/util/precision_sensitive_attribute.hpp" |
45 | 47 | #include "openvino/op/variadic_split.hpp"
|
46 | 48 | #include "openvino/pass/manager.hpp"
|
47 | 49 | #include "openvino/pass/pattern/op/optional.hpp"
|
@@ -265,6 +267,33 @@ class MarkExp : public pass::MatcherPass {
|
265 | 267 | register_matcher(m, callback);
|
266 | 268 | }
|
267 | 269 | };
|
| 270 | + |
| 271 | +class MarkRandomUniform : public pass::MatcherPass { |
| 272 | +public: |
| 273 | + OPENVINO_MATCHER_PASS_RTTI("MarkRandomUniform"); |
| 274 | + |
| 275 | + MarkRandomUniform() { |
| 276 | + MATCHER_SCOPE(MarkRandomUniform); |
| 277 | + auto random_uniform_pattern = pattern::wrap_type<ov::op::v8::RandomUniform>(); |
| 278 | + |
| 279 | + matcher_pass_callback callback = [=](pattern::Matcher& m) { |
| 280 | + const auto& node = m.get_match_root(); |
| 281 | + if (!node) |
| 282 | + return false; |
| 283 | + |
| 284 | + disable_fp16_compression(node); |
| 285 | + for (const auto& output : node->outputs()) { |
| 286 | + for (const auto& out_inputs : output.get_target_inputs()) { |
| 287 | + mark_as_precision_sensitive(out_inputs); |
| 288 | + } |
| 289 | + } |
| 290 | + return false; |
| 291 | + }; |
| 292 | + auto m = make_shared<pattern::Matcher>(random_uniform_pattern, matcher_name); |
| 293 | + register_matcher(m, callback); |
| 294 | + } |
| 295 | +}; |
| 296 | + |
268 | 297 | /* MarkExpInReduceOpPath marks path that goes into ReduceSum and ReduceMean.
|
269 | 298 | * Values that go from Exp to ReduceSum/ReduceMean are precision
|
270 | 299 | * sensitive and should be kept in f32 precision for mixed inference.
|
@@ -435,6 +464,7 @@ bool MarkSugraphsToKeepInMixedPrecision::run_on_model(const shared_ptr<ov::Model
|
435 | 464 | REGISTER_PASS(manager, ov::pass::MarkFloatingPointRange)
|
436 | 465 | REGISTER_PASS(manager, MarkDivWithEps)
|
437 | 466 | REGISTER_PASS(manager, MarkExpInReduceOpPath)
|
| 467 | + REGISTER_PASS(manager, MarkRandomUniform) |
438 | 468 | REGISTER_PASS(manager, PropagateDownDisableSensitivityForQuantized)
|
439 | 469 |
|
440 | 470 | // both Up and Down propagations are needed.
|
|
0 commit comments