-chlo-legalize-to-stablehlo
Legalizes from CHLO ops flow to StableHLO and Shape ops
-shape-legalize-to-stablehlo
StableHLO-তে আকৃতি-সম্পর্কিত অপারেশনগুলিকে বৈধ করুন।
An experimental pass that legalizes shape-related ops to StableHLO ops.
ঐচ্ছিক পাসের মাধ্যমে আকৃতি এবং ডেটা গণনা একত্রিত করার ফলে StableHLO ইকোসিস্টেমটি সম্ভাব্যভাবে সংকলন পাইপলাইনগুলিকে কাজে লাগাতে পারবে যা StableHLO অপারেশন ব্যবহার করে গতিশীলতার মডেল তৈরি করবে।
-stablehlo-canonicalize-dynamism
Canonicalizes dynamic StableHLO ops into static ops.
যদি = এই অপশনের সমস্ত গতিশীল উপাদান আসলে ধ্রুবক হয়, তাহলে DynamicReshapeOp-এর মতো গতিশীল StableHLO অপশনগুলিকে DynamicReshapeOp কে ReshapeOp বা DynamicBroadcastInDim কে BroadcastInDim এর মতো সংশ্লিষ্ট স্ট্যাটিক প্রতিরূপ দিয়ে প্রতিস্থাপন করে।
%c = stablehlo.constant dense<16> : tensor<1xi32>
%0 = stablehlo.dynamic_broadcast_in_dim %cst, %c, dims = [] : (tensor<f32>, tensor<1xi32>) -> tensor<16xf32>
==>
%0 = stablehlo.broadcast_in_dim %cst, dims = [] : (tensor<f32>) -> tensor<16xf32>
-stablehlo-check-shape-assertions
_Check stablehlo.custom_call @shape assertion ops.
আকৃতি_জাহিরকরণ কাস্টম কলগুলি যাচাই করুন।
Shape assertions validate constraints on dynamic dimensions in StableHLO. For example if a framework needed to enforce a constraint of DimA < 2 , the following IR could be emitted:
%dimA = <get_dimension_size or input arg> : tensor<i32>
%c2 = stablehlo.constant dense<2> : tensor<i32>
%is_lt = stablehlo.compare LT %dimA, %c2 : tensor<i1>
stablehlo.custom_call @shape_assertion(%is_lt) { error_message = "DimA must be less than 2" }
After the pass, if the shapes are correct, the stablehlo.custom_call will be removed.
বিকল্পগুলি
-enable-shape-assertions : Whether shape assertions may generate errors.
-stablehlo-compatibility-expander
StableHLO অপারেশনের জন্য সামঞ্জস্যপূর্ণ এক্সপান্ডার।
StableHLO ops আপডেট পায় অথবা সর্বশেষ সংস্করণগুলিতে নতুন op চালু করা হয়। এই অপ্ট-ইন পাসটি নতুন StableHLO ক্রিয়াকলাপগুলিকে সেই পুরানো সংস্করণগুলির দ্বারা সমর্থিত সমতুল্য ক্রিয়াকলাপগুলিতে বিভক্ত করে পুরানো StableHLO সংস্করণগুলির সাথে ব্যাকওয়ার্ড সামঞ্জস্যতা প্রসারিত করে।
কেন এটি একটি অপ্ট-ইন পাস?
মাঝেমধ্যে, OpenXLA ইকোসিস্টেমের কিছু সাধারণ প্যাটার্ন পরিচালনা সহজ করার জন্য StableHLO op বর্ধিতকরণ ব্যবহার করা হয়। এর মধ্যে রয়েছে TanOp, যার উচ্চ ফ্রেমওয়ার্ক এবং কম্পাইলার সমর্থন রয়েছে, সেইসাথে সংগ্রহ/বিচ্ছুরণ ব্যাচিং মাত্রা, যা স্লাইস ব্যবহার করে উপস্থাপন করা যেতে পারে, তবে শারডিংকে আরও কঠিন করে তোলে। এই শ্রেণীর নতুন বৈশিষ্ট্যগুলির জন্য, আমরা স্বয়ংক্রিয় ডাউনগ্রেড অফার করি না, কারণ এটি পরবর্তী অপ্টিমাইজেশনে ব্যবহৃত গুরুত্বপূর্ণ তথ্য নষ্ট করে দিতে পারে। সম্ভাব্য কম অনুকূল সংকলনের ব্যয়ে সামঞ্জস্যতা সর্বাধিক করার জন্য একটি লক্ষ্য সংস্করণের উপর ভিত্তি করে এই অপশনগুলি প্রসারিত করতে এই পাসটি ব্যবহার করা যেতে পারে।
func.func @tan_op_non_complex(%arg0: tensor<4xf64>) -> tensor<4xf64> {
%1 = stablehlo.tan %arg0 : tensor<4xf64>
func.return %1 : tensor<4xf64>
}
==>
func.func @tan_op_non_complex(%arg0: tensor<4xf64>) -> tensor<4xf64> {
%0 = stablehlo.sine %arg0 : tensor<4xf64>
%1 = stablehlo.cosine %arg0 : tensor<4xf64>
%2 = stablehlo.divide %0, %1 : tensor<4xf64>
return %2 : tensor<4xf64>
}
বিকল্পগুলি
-target : The target version. Must be a version of the form #.#.#.
-stablehlo-complex-math-expander
StableHLO জটিল গণিত ক্রিয়াকলাপের জন্য এক্সপ্যান্ডার।
StableHLO complex math operations are decompositions using StableHLO real math operations.
এই বিবৃতিটি এই ধারণার উপর ভিত্তি করে তৈরি যে জটিল সংখ্যা বা জটিল গণিত ক্রিয়াকলাপগুলিকে স্থানীয়ভাবে সমর্থন করে এমন কোনও হার্ডওয়্যার বিদ্যমান নেই। এর অর্থ হল কম্পাইলাররা যে জটিল গণিত ক্রিয়াকলাপগুলি বাস্তবায়ন করতে পারে তার উপর ফলব্যাক প্রক্রিয়াগুলি অপ্রয়োজনীয়। এই পাসটি সক্ষম করার মাধ্যমে, সমস্ত StableHLO জটিল গণিত ক্রিয়াকলাপ প্রসারিত হবে।
func.func @sqrt_op_complex(%arg0: tensor<4xcomplex<f64>>) -> tensor<4xcomplex<f64>> {
%1 = stablehlo.sqrt %arg0 : tensor<4xcomplex<f64>>
func.return %1 : tensor<4xcomplex<f64>>
}
==>
func.func @sqrt_op_complex(%arg0: tensor<4xcomplex<f64>>) -> tensor<4xcomplex<f64>> {
TBD
return %2 : tensor<4xcomplex<f64>>
}
-stablehlo-convert-to-signless
Pass to transform the IR to be on signless integers.
-stablehlo-legalize-composite-to-call
Replaces composite ops with a call to their decomposition.
Replaces composite ops with a call to their decomposition, eg the below:
stablehlo.composite "my_namespace.my_op" %arg0, %arg1 {
decomposition = @bar,
version = 1,
composite_attributes = {
"my_attribute": "my_value"
}
}
হয়ে যাবে:
func.call @bar(%arg0, %arg1)
A subset of composites can be excepted from this transformation using the "except" flag, eg:
stablehlo-opt --stablehlo-legalize-composite-to-call=except='foo.baz,foo.qux'
বিকল্পগুলি
-except : Names of composites that should not be replaced with calls.
-stablehlo-legalize-deprecated-ops
অবহেলিত অপারেশনগুলিকে সু-সমর্থিত অপারেশনে বৈধ করুন।
StableHLO v1.0 Opset Deprecations RFC (#2283) বেশ কিছু অপ্রয়োজনীয় অপশন অপসারণের প্রস্তাব করে। এই পাসটি বিভিন্ন সংকলন পাইপলাইনে এই অপশন অপসারণের প্রভাব মূল্যায়ন করতে সাহায্য করে, দীর্ঘমেয়াদী সমর্থিত প্রতিপক্ষের কাছে বৈধ করে।
বিকল্পগুলি
-fail-on-unused : Fail on (mostly) unused ops that are deprecated without any fallback.
-stablehlo-legalize-qdq-to-quantized-op
Fuse (de-quantize, floating-point operation and quantize) pattern into StableHLO quantized operation
Fuse (de-quantize, floating-point operation and quantize) pattern into StableHLO quantized operation Note: The pass does not delete any preexisting op. For example, the following program
func.func @add(%arg0: tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>) -> tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>> {
%0 = stablehlo.uniform_dequantize %arg0 : (tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>) -> tensor<16x16xf32>
%1 = stablehlo.abs %0 : tensor<16x16xf32>
%2 = stablehlo.uniform_quantize %1 : (tensor<16x16xf32>) -> tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>
func.return %2 : tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>
}
হয়ে যাবে:
func.func @add(%arg0: tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>) -> tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>> {
%0 = stablehlo.uniform_dequantize %arg0 : (tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>) -> tensor<16x16xf32>
%1 = stablehlo.abs %0 : tensor<16x16xf32>
%2 = stablehlo.abs %arg0 : tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>
%3 = stablehlo.uniform_quantize %1 : (tensor<16x16xf32>) -> tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>
return %2 : tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>
}
-stablehlo-legalize-quant-to-math
Convert from StableHLO quantized ops to StableHLO primitive math ops.
Convert StableHLO programs using UniformQuantized types to semantically equivalent integer math operations.
func.func @add(%arg0: tensor<!quant.uniform<i8:f32,1.0:0>>, %arg1: tensor<!quant.uniform<i8:f32,2.0:1>>) -> tensor<!quant.uniform<i8:f32,3.0:2>> {
%0 = "stablehlo.add"(%arg0, %arg1) : (tensor<!quant.uniform<i8:f32,1.0:0>>, tensor<!quant.uniform<i8:f32,2.0:1>>) -> tensor<!quant.uniform<i8:f32,3.0:2>>
func.return %0 : tensor<!quant.uniform<i8:f32,3.0:2>>
}
হয়ে যাবে:
func.func @add(%arg0: tensor<i8>, %arg1: tensor<i8>) -> tensor<i8> {
%0 = stablehlo.convert %arg0 : (tensor<i8>) -> tensor<f32>
%cst = stablehlo.constant dense<0.333333343> : tensor<f32>
%1 = chlo.broadcast_multiply %0, %cst : (tensor<f32>, tensor<f32>) -> tensor<f32>
%cst_0 = stablehlo.constant dense<2.000000e+00> : tensor<f32>
%2 = chlo.broadcast_add %1, %cst_0 : (tensor<f32>, tensor<f32>) -> tensor<f32>
%3 = stablehlo.round_nearest_even %2 : tensor<f32>
%4 = stablehlo.convert %3 : (tensor<f32>) -> tensor<i32>
%5 = stablehlo.convert %arg1 : (tensor<i8>) -> tensor<f32>
%cst_1 = stablehlo.constant dense<0.666666686> : tensor<f32>
%6 = chlo.broadcast_multiply %5, %cst_1 : (tensor<f32>, tensor<f32>) -> tensor<f32>
%cst_2 = stablehlo.constant dense<1.33333337> : tensor<f32>
%7 = chlo.broadcast_add %6, %cst_2 : (tensor<f32>, tensor<f32>) -> tensor<f32>
%8 = stablehlo.round_nearest_even %7 : tensor<f32>
%9 = stablehlo.convert %8 : (tensor<f32>) -> tensor<i32>
%c = stablehlo.constant dense<2> : tensor<i32>
%10 = chlo.broadcast_add %4, %9 : (tensor<i32>, tensor<i32>) -> tensor<i32>
%11 = chlo.broadcast_subtract %10, %c : (tensor<i32>, tensor<i32>) -> tensor<i32>
%c_3 = stablehlo.constant dense<-128> : tensor<i32>
%c_4 = stablehlo.constant dense<127> : tensor<i32>
%12 = stablehlo.clamp %c_3, %11, %c_4 : tensor<i32>
%13 = stablehlo.convert %12 : (tensor<i32>) -> tensor<i8>
return %13 : tensor<i8>
}
-stablehlo-legalize-quantized-op-to-qdq
Decompose quantized StableHLO operation to (de-quantize, floating-point operation and quantize) pattern.
Decompose StableHLO quantized programs using uniform quantize/dequantize operations. For example, the following program
func.func @add(%arg0: tensor<!quant.uniform<i8:f32,1.0:0>>, %arg1: tensor<!quant.uniform<i8:f32,2.0:1>>) -> tensor<!quant.uniform<i8:f32,3.0:2>> {
%0 = "stablehlo.add"(%arg0, %arg1) : (tensor<!quant.uniform<i8:f32,1.0:0>>, tensor<!quant.uniform<i8:f32,2.0:1>>) -> tensor<!quant.uniform<i8:f32,3.0:2>>
func.return %0 : tensor<!quant.uniform<i8:f32,3.0:2>>
}
হয়ে যাবে:
func.func @add(%arg0: tensor<!quant.uniform<i8:f32, 1.000000e+00>>, %arg1: tensor<!quant.uniform<i8:f32, 2.000000e+00:1>>) -> tensor<!quant.uniform<i8:f32, 3.000000e+00:2>> {
%0 = stablehlo.uniform_dequantize %arg0 : (tensor<!quant.uniform<i8:f32, 1.000000e+00>>) -> tensor<f32>
%1 = stablehlo.uniform_dequantize %arg1 : (tensor<!quant.uniform<i8:f32, 2.000000e+00:1>>) -> tensor<f32>
%2 = stablehlo.add %0, %1 : tensor<f32>
%3 = stablehlo.uniform_quantize %2 : (tensor<f32>) -> tensor<!quant.uniform<i8:f32, 3.000000e+00:2>>
return %3 : tensor<!quant.uniform<i8:f32, 3.000000e+00:2>>
}
-stablehlo-legalize-to-vhlo
StableHLO কে VHLO তে বৈধ করুন।
Legalize StableHLO to the latest version of ops in VHLO. These ops can then be downgraded to older versions of VHLO for forward compatibility using VhloToVersionPass .
stablehlo.exponential %[[ARG0]] <{result_accuracy = DEFAULT}> : tensor<f32>
# ====>
"vhlo.exponential_v2"(%[[ARG0]]) <{result_accuracy = #vhlo.DEFAULT_v1}> : !vhlo.tensor_v1<!vhlo.f32_v1>
See vhlo.md > The VHLO dialect for full details on how VHLO is used to preserve forward and backward compatibility.
বিকল্পগুলি
-allow-other-dialects : Allow serialization to use other (potentially unstable) dialects, inserts unrealized casts between dialects.
-stablehlo-refine-arguments
Refines the argument shapes of the main function.
ইনপুট টাইপ সিগনেচার ব্যবহার করে প্রধান ফাংশনের আর্গুমেন্ট পরিবর্তন করে। আকৃতি সংশোধন চালানোর আগে IR বৈধ রাখার জন্য custom_call @stablehlo.shape_refinement_operand_wrapper এ আর্গুমেন্টগুলি মোড়ানো হয়।
func.func public @main(%arg0: tensor<?xf32>) -> tensor<?xf32> {
...
}
==>
func.func public @main(%arg0: tensor<16xf32>) -> tensor<?xf32> {
%c = stablehlo.constant dense<16> : tensor<1xi64>
%0 = stablehlo.custom_call @stablehlo.shape_refinement_operand_wrapper(%arg0, %c) {...}
: (tensor<16xf32>, tensor<1xi64>) -> tensor<?xf32>
...
}
refinedTypesOption ব্যবহার করে রিফাইন্ড টাইপের তালিকা নির্দিষ্ট করা যেতে পারে। এটি MLIR-এ --types='tensor<...>,tensor<...>' দিয়ে নির্দিষ্ট করা যেতে পারে, অথবা pass create পদ্ধতিতে পাস করা যেতে পারে। রিফাইন্ড টাইপ তালিকায় রিফাইন্ড করা main পদ্ধতির প্রতিটি আর্গুমেন্টের ধরণ নির্দিষ্ট করতে হবে।
বিকল্পগুলি
-types : The new types to be used for the main function's arguments, specified as an MLIR TypeRange 'tensor<1x2xf32>, ...'
-stablehlo-refine-shapes
একটি StableHLO প্রোগ্রাম জুড়ে আকারগুলিকে পরিমার্জন করে।
Walks through a StableHLO program refining shapes within ops.
এই পাসের প্রধান ব্যবহারের ক্ষেত্রে স্ট্যাটিক শেপগুলিতে গতিশীল-আকৃতির প্রোগ্রামগুলিকে বিশেষায়িত করা হচ্ছে। যদি একটি গতিশীল-আকৃতির StableHLO প্রোগ্রামের সঠিক কাঠামো থাকে, তাহলে এর আর্গুমেন্ট প্রকারগুলিকে গতিশীল আকার থেকে স্ট্যাটিক আকারে আপডেট করা এবং এই পাসটি চালানো প্রোগ্রাম জুড়ে স্ট্যাটিক আকারগুলিকে প্রচার করবে।
This pass removes custom_call @shape_refinement_operand_wrapper by replacing uses of the result with the operand directly, and propagates static shapes throughout the program.
%c = stablehlo.constant dense<16> : tensor<1xi64>
%0 = stablehlo.custom_call @stablehlo.shape_refinement_operand_wrapper(%arg0, %c) {...}
: (tensor<16xf32>, tensor<1xi64>) -> tensor<?xf32>
%1 = stablehlo.add %0, %0 : tensor<?xf32>
==>
%1 = stablehlo.add %arg0, %arg0 : tensor<16xf32>
Modules valid for shape refinement must have the following properties:
- সমস্ত গতিশীল আকার শুধুমাত্র ইনপুট আকারের উপর নির্ভর করে (ইনপুট অ্যারের বিষয়বস্তুর উপর কোন আকৃতি নির্ভরতা নেই)। আমরা সেই ক্রিয়াকলাপগুলিকে উল্লেখ করি যা কেবলমাত্র ইনপুট আকারের উপর নির্ভর করে (যেমন,
stablehlo.get_dimension_sizeদ্বারা প্রদত্ত) অথবা প্রতীকী পূর্ণসংখ্যার সমাধান করা মানগুলির মতো গ্লোবাল ধ্রুবক (যেমন টেনসর)।: A = 5), as dimensionoperations. All dimension values can be resolved to constants through inter-procedural constant folding. - ইন্টারমিডিয়েট ফাংশনগুলি আর্গুমেন্ট তালিকার শুরুতে বেশ কয়েকটি টোকেন আর্গুমেন্ট ( !stablehlo.token ধরণের) নিতে পারে, তারপরে কিছু গ্লোবাল ধ্রুবক আর্গুমেন্ট থাকে যা ধ্রুবক পূর্ণসংখ্যা স্কেলার, যেমন প্রতীকী পূর্ণসংখ্যার সমাধান করা মান (যেমন টেনসর
: ক = ৫)। - কিছু মধ্যবর্তী ফাংশন গ্লোবাল ধ্রুবকের উপর গণনা ফেরত দিতে পারে, যেমন symint মানের উপর
floordiv। এই ফাংশনগুলি শুধুমাত্র পরিমার্জনের পরে ধ্রুবক মান ফেরত দিয়ে নির্দেশিত হয়। এই ফাংশনগুলি ইনলাইন করা হয়। - All calls to a single function resolve to the same argument shapes, and no recursive / co-recursive function calls are made.
-stablehlo-wrap-in-composite
Wraps a non-composite StableHLO op in a composite op.
Wraps StableHLO operations in stablehlo.composite operations.
For instance, consider a simple StableHLO program:
func.func @main(%arg0 : tensor<2xf32>, %arg1 : tensor<2xf32>) -> tensor<2xf32> {
%0 = stablehlo.add %arg0, %arg1 : tensor<2xf32>
return %0 : tensor<2xf32>
}
Applying this pass to wrap stablehlo.add operations will result in the following program:
func.func @main(%arg0: tensor<2xf32>, %arg1: tensor<2xf32>) -> tensor<2xf32> {
%0 = stablehlo.composite "stablehlo.add" %arg0, %arg1 {decomposition = @stablehlo.add.impl} : (tensor<2xf32>, tensor<2xf32>) -> tensor<2xf32>
return %0 : tensor<2xf32>
}
func.func private @stablehlo.add.impl(%arg0: tensor<2xf32>, %arg1: tensor<2xf32>) -> tensor<2xf32> {
%0 = stablehlo.add %arg0, %arg1 : tensor<2xf32>
return %0 : tensor<2xf32>
}
নোট:
- জেনারেট করা
stablehlo.compositeঅপারেশনেরnameঅ্যাট্রিবিউটটি সর্বদা মূল র্যাপ করা অপারেশনের নামের মতোই থাকবে (যেমন, যদি আপনি একটিstablehlo.addঅপারেশন র্যাপ করেন, তাহলে কম্পোজিটটির নামও"stablehlo.add"হবে)। - যে প্রাইভেট ফাংশনটি মূল অপারেশনকে (
stablehlo.compositeঅপারেশনেরdecompositionঅ্যাট্রিবিউট দ্বারা উল্লেখিত) ধারণ করে তার নামকরণ করা হবে<op_name>.impl[.N]প্যাটার্ন ব্যবহার করে, যেখানে<op_name>হল মূল অপারেশনের নাম, এবংNহল একটি অনন্য পূর্ণসংখ্যা শনাক্তকারী যা মডিউলের মধ্যে নামকরণের দ্বন্দ্ব প্রতিরোধ করার জন্য তৈরি করা হয়।
এই পাসটি দুটি স্বতন্ত্র উপায়ে ব্যবহার করা যেতে পারে:
মোড ১: কমান্ড-লাইন ব্যবহার
এই মোডটি ডিবাগিং বা পরীক্ষার জন্য তৈরি, কারণ এটি তৈরি করা stablehlo.composite অপারেশনের বৈশিষ্ট্যের উপর ন্যূনতম নিয়ন্ত্রণ প্রদান করে। এটি op-names (অপারেশন নামের একটি কমা-বিভাজিত তালিকা) বিকল্প ব্যবহার করে নির্দিষ্ট করা সমস্ত অপারেশনের উদাহরণগুলিকে মোড়ানো হয়। নতুন তৈরি stablehlo.composite অপারেশনের বৈশিষ্ট্যগুলি মূল অপারেশনের বৈশিষ্ট্যগুলির মতোই হবে।
ব্যবহারের উদাহরণ:
stablehlo-opt input.mlir --stablehlo-wrap-in-composite=op-names='stablehlo.add,stablehlo.mul' -o output.mlir
Mode 2: Programmatic Module-Wide Wrapping with customized Attribute Handling
এই মোডটি সম্পূর্ণ মডিউলে প্রোগ্রাম্যাটিক র্যাপিং প্রসারিত করে, কোন অপারেশনগুলি র্যাপ করা হবে এবং তাদের বৈশিষ্ট্যগুলির উপর সূক্ষ্ম নিয়ন্ত্রণ প্রদান করে। এটি createStablehloWrapInCompositePass API ব্যবহার করে অর্জন করা হয়, যা একটি CompositeAttributeProviderMap একটি আর্গুমেন্ট হিসেবে গ্রহণ করে।
The CompositeAttributeProviderMap is a map that dictates which operations should be considered for wrapping and how their attributes should be handled. Its semantics are as follows:
- Keys (mlir::TypeID):
TypeIDof an MLIR operation. If an operation'sTypeIDmatches a key in the map, it becomes a candidate for wrapping. - Values (Lambda Functions): Lambda function of type
std::function<std::optional<NamedAttrList>(Operation*)>. This function is applied to each candidate operation.- Input: An
mlir::Operation*, which is an instance of the operation type corresponding to theTypeIDkey. - রিটার্ন মান: একটি
std::optional<NamedAttrList>।- যদি ল্যাম্বডা একটি
NamedAttrList(std::optionalদিয়ে মোড়ানো) ফেরত দেয়, তাহলে অপারেশনটি একটিstablehlo::compositeঅপারেশনে মোড়ানো হয় এবং ফিরে আসা অ্যাট্রিবিউটগুলি কম্পোজিটটির অ্যাট্রিবিউট সেট করতে ব্যবহৃত হয়। - If the lambda returns
std::nullopt, the operation is not wrapped. This allows for selective wrapping based on custom criteria.
- যদি ল্যাম্বডা একটি
- Input: An
উদাহরণ (C++):
stablehlo::CompositeAttributeProviderMap compositeAttributeProviderMap;
compositeAttributeProviderMap[mlir::TypeID::get<mlir::stablehlo::AddOp>()] =
[](mlir::Operation* op) -> std::optional<mlir::NamedAttrList> {
// Custom logic to determine if and how to wrap the operation.
// Example: Only wrap if it's on a specific type.
if (mlir::isa<mlir::Float32Type>(op->getOperand(0).getType())) {
return mlir::NamedAttrList(op->getAttrs());
}
return std::nullopt; // Do not wrap.
};
pm.addPass(createStablehloWrapInCompositePass(compositeAttributeProviderMap, compositeVersion));
if (mlir::failed(pm.run(module))) {
return;
}
বিকল্পগুলি
-op-names : The names of the ops to wrap.
-version : The version number of the composite op.
-vhlo-legalize-to-stablehlo
VHLO কে StableHLO তে বৈধ করুন।
-vhlo-to-version
Convert between versions of VHLO for compatibility.
Converts between versions of VHLO for IR upgrading and downgrading to preserve forward and backward compatibility.
"vhlo.exponential_v2"(%[[ARG0]]) <{result_accuracy = DEFAULT}>
# ==( -target=1.0.0 )==>
"vhlo.exponential_v1"(%[[ARG0]])
# ==( -target=1.9.0 )==>
"vhlo.exponential_v2"(%[[ARG0]]) <{result_accuracy = DEFAULT}>
See vhlo.md > The VHLO dialect for full details on how VHLO is used to preserve forward and backward compatibility.
বিকল্পগুলি
-target : The target version. Must be a version of the form #.#.# .