-sdy-close-shardings

텐서 샤딩을 닫고 복제된 축을 삭제합니다.

-sdy-constant-or-scalar-merger

일치하는 샤딩으로 동일한 상수 및 스칼라 확장을 병합합니다.

동일한 샤딩으로 상수에 대해 경량 CSE를 실행합니다.

가져오기 파이프라인은 상수 및 스칼라 확장을 분할하고 복제하여 상수 하위 계산의 여러 용도 간에 샤딩이 전파되지 않도록 합니다. 전파 후 상수에 동일한 샤딩이 있는 경우 이 패스는 컴파일 시간을 절약하기 위해 상수를 병합합니다. 자세한 내용은 -sdy-constant-or-scalar-splitter를 참고하세요.

-sdy-convert-global-to-local

SDY 프로그램을 전역 도형에서 로컬 도형으로 변환합니다.

샤딩 속성을 기반으로 논리적 측정기준을 분할하여 SDY 프로그램을 전역 도형에서 로컬 도형으로 변환합니다.

이 패스는 유형 변환기를 활용하여 RankedTensorType을 전역 논리적 도형에서 기기 로컬 물리적 도형으로 매핑합니다.

옵션

-per-dim-all-gather                     : Keep per-dimension all-gather without combining them into a single all-gather.
-combine-multi-dimension-reduce-scatter : Combine multi-dimension reduce-scatter into a single reduce-scatter.
-enable-rgv3                            : Use StableHLO ReplicaGroupV3 (mesh-axes based) for collectives.
-replica-count                          : Number of replicas (data parallelism).
-partition-count                        : Number of partitions (model parallelism).

-sdy-drop-sharding-and-mesh

프로그램에서 메시 작업 및 샤딩 표기법을 삭제합니다.

-sdy-drop-sharding-rules

등록된 모든 작업에서 OpShardingRuleAttr을 삭제합니다.

-sdy-export-named-computations

NamedComputationOp에서 호출을 간략하게 설명합니다.

NamedComputationOpname이라는 새 비공개 함수를 사용하여 NamedComputationOpCallOp로 변환하는 패스를 만듭니다. 새 FuncOpCallOp는 원래 NamedComputationOp의 피연산자/결과와 동일한 샤딩을 갖습니다.

모듈에 NamedComputationOp와 이름이 같은 함수가 있는 경우 MLIR 기호 테이블은 이를 {name}_#으로 변경합니다.

-sdy-insert-explicit-reshards

모든 작업에 호환되는 샤딩이 있도록 명시적 재샤딩을 삽입합니다.

호환되는 샤딩은 기본적으로 작업이 재샤딩 통신을 요구하지 않고 샤딩된 피연산자를 수락하고 샤딩된 결과를 생성할 수 있음을 의미합니다 (작업에 all-reduce 또는 halo-swaps와 같은 통신이 여전히 필요할 수 있음).

전파 후에도 일부 작업에는 여전히 호환되지 않는 샤딩이 있을 수 있습니다.

축 (또는 하위 축)이 여러 텐서에서 상응하지 않는 측정기준 (예: matmul의 비수축 측정기준)을 샤딩하는 데 사용되거나 축이 한 텐서의 측정기준을 샤딩하지만 다른 텐서의 상응하는 측정기준을 샤딩하지 않는 경우 작업에 샤딩 충돌이 있다고 합니다. 따라서 이 패스 후에는 작업에 충돌이 발생하지 않습니다.

이 패스는 각 작업에 대해 상응하는 측정기준이 모든 피연산자와 결과에서 동일한 방식으로 샤딩되고 모든 축 (또는 하위 축)이 단일 측정기준 유형을 샤딩하는 데만 사용될 수 있도록 재샤딩 작업을 명시적으로 삽입합니다.

예:

입력:

mesh = <"x"=4, "y"=2>
%lhs : tensor<8x32xf32> {sdy.sharding=<@mesh, \[{"x"}, {"y"}\]>}
%rhs : tensor<32x16xf32> {sdy.sharding=<@mesh, \[{"y"}, {"x"}\]>}
stablehlo.dot %lhs, %rhs {sdy.sharding_per_value=<[<@mesh, \[{"x"}, {}\]>]>}
  : (tensor<8x32xf32>, tensor<32x16xf32>) -> tensor<8x16xf32>

출력:

sdy.mesh = <"x"=4, "y"=2>
%lhs : tensor<8x32xf32> {sdy.sharding=<@mesh, \[{"x"}, {"y"}\]>}
%rhs : tensor<32x16xf32> {sdy.sharding=<@mesh, \[{"y"}, {"x"}\]>}
%0 = sdy.reshard %rhs <@mesh, \[{"y"}, {}\]> : tensor<32x16xf32>
stablehlo.dot %lhs, %0 {sdy.sharding_per_value=<[<@mesh, \[{"x"}, {}\]>]>}
  : (tensor<8x32xf32>, tensor<32x16xf32>) -> tensor<8x16xf32>

위의 예에서 lhsrhs는 모두 호환되지 않는 비수축 측정기준의 'x' 축에서 샤딩됩니다. 패스는 점 연산 전에 rhs에 명시적 재샤딩을 삽입하여 점 연산에 호환되는 샤딩이 있도록 합니다.

옵션

-enable-full-version : Enable full version.

-sdy-insert-func-call-reshards

함수 및 호출 샤딩 충돌을 위한 재샤딩을 삽입합니다.

결과에 대한 함수 및 호출 샤딩 충돌을 위한 재샤딩을 삽입합니다.

-sdy-optimize-collectives

집단 통신 작업을 최적화합니다.

분할 측정기준을 분해하고 결합된 all-to-all로 융합하여 all-to-all 체인 앞에 있는 중복 집단 순열 작업을 삭제합니다.

-sdy-pad-for-divisibility

나눌 수 없는 샤딩이 있는 텐서를 나눌 수 있는 도형으로 패딩합니다.

-sdy-per-instruction-partitioning

_타겟 명령어를 선택적으로 추출하고, 파티셔너 파이프라인을 실행하여 기기 로컬 코드를 생성하고, sdy.manualcomputation.에 래핑합니다._

디버깅 및 이분법적 목적으로 독립형 Shardy 파티셔너 파이프라인 (resolve-permutation-factors, reshard-to-collectives, pad-for-divisibility, convert-global-to-local)을 사용하여 개별 명령어를 선택적으로 분할하고 결과 기기 로컬 코드를 sdy.manual_computation 내부에 래핑합니다. 이렇게 하면 나머지 전역 프로그램이 그대로 유지되므로 XLA SPMD는 래핑되지 않은 전역 명령어만 분할합니다.

옵션

-filter               : Filter string for selective partitioning. Can be empty (all sharded ops), comma-separated op name substrings (e.g. 'dot, pad'), or key-values like 'selectLow=0, selectHigh=10'.
-enable-halo-exchange : Implement halo exchange logic for windowed operations inside the sub-pipeline.
-replica-count        : Number of replicas (data parallelism).
-partition-count      : Number of partitions (model parallelism).

-sdy-propagate-to-func-results

함수 종료자에서 함수 결과로 샤딩을 전파합니다.

함수 종료자 값의 샤딩을 상응하는 func.func 결과에 복사하여 기본 함수의 기존 샤딩을 보존합니다.

-sdy-remove-all-gather-reduce-scatter-for-cmv1

_CMV1의 sdy.all_gather 및 sdy.reducescatter를 삭제합니다.

패턴 all-gather + dot에서 all-gather를 삭제합니다. 패턴 dot + reduce-scatter에서 reduce-scatter를 삭제합니다. 이 패스는 집단 matmul V1 (CMV1)과의 호환성을 위한 것입니다. b/432019089의 임시 해결책입니다.

-sdy-remove-propagation-debug-info

내보내기 중에 전파 디버그 정보 (전파 가장자리 및 출처 샤딩)를 삭제합니다.

-sdy-remove-sharding-groups

전파 후 ShardingGroupOps를 삭제합니다.

-sdy-remove-sub-axes-in-input-output-shardings

입력/출력 샤딩에서 하위 축을 삭제합니다.

Shardy의 일부 사용자는 함수 입력/출력에 하위 축이 없는 샤딩이 있을 것으로 예상합니다. 이 패스는 입력/출력 열린 측정기준 샤딩에서 하위 축과 후행 축을 삭제합니다. 이 패스는 일반적으로 sdy-update-non-divisible-input-output-shardings 후에 하위 축 삭제로 인해 나눌 수 없는 샤딩이 발생하지 않도록 합니다.

-sdy-reshard-to-collectives

ReshardOp를 다양한 Shardy 집단 작업으로 변환합니다.

재샤딩 작업을 일치시키고 다양한 Shardy 집단 작업으로 다시 작성합니다. 이 패스 후에는 모듈에 재샤딩 작업이 남아 있지 않습니다.

선택적으로 keepRedundantReshards가 true인 경우 남아 있는 재샤딩 작업은 중복된 작업뿐입니다. 기본적으로 명시적 재샤딩이 이미 삽입되었다고 가정하고 (sdy-insert-explicit-reshards) 중복 재샤딩을 유지하지 않습니다. 명시적 재샤딩이 아직 삽입되지 않았을 수 있는 경우 중복 재샤딩을 유지해야 합니다.

예:

입력:

mesh = <"x"=2, "y"=2, "z"=2>
%0 : tensor<16x2xf32> {sdy.sharding<@mesh, \[{"x", "y", "z"}, {}\]>
%1 = sdy.reshard %arg0 <@mesh, \[{"x"}, {}\]> : tensor<16x2xf32>

출력:

mesh = <"x"=2, "y"=2, "z"=2>
%0 : tensor<16x2xf32> {sdy.sharding<@mesh, \[{"x", "y", "z"}, {}\]>
%1 = sdy.all_gather \[{"y", "z"}, {}\] %arg0 out_sharding=<@mesh, \[{"x"}, {}\]> : tensor<16x2xf32>

위의 예에서 텐서 %0 : tensor<16x2xf32>\[{"x", "y", "z"}, {}\]로 샤딩됩니다. 그런 다음 reshard로 재샤딩하는 \[{"x"}, {}\] 작업이 있습니다. 첫 번째 축에서 재샤딩 후 접미사 {"y", "z"}가 삭제되므로 {"y", "z"}를 모두 수집한 것으로 추론합니다. 두 번째 측정기준은 변경되지 않습니다.

옵션

-keep-redundant-reshards : Whether it keeps redundant reshards or removes.

-sdy-resolve-permutation-factors

kPermutation 요소에 매핑된 측정기준의 샤딩을 확인합니다.

kPermutation 요소가 있는 샤딩 측정기준에는 교차 기기 통신이 필요할 수 있습니다 (예: 창의 경우 halo 교환 또는 역방향의 경우 집단 순열).

enableHaloExchange가 true이면 패스는 사용 가능한 최적화된 통신 로직을 사용하여 순열 요소를 확인합니다. 그렇지 않으면 패스는 단순히 sdy.reshard 작업을 삽입하여 이러한 측정기준을 복제합니다. enableHaloExchange의 기본값은 true입니다.

옵션

-enable-halo-exchange : Implement halo exchange logic for windowed operations.
-replica-count        : Number of replicas (data parallelism).
-partition-count      : Number of partitions (model parallelism).

-sdy-resolve-single-device-sharding

대상 기기 ID로 보호되는 경우 단일 기기 작업을 stablehlo로 낮춥니다.

옵션

-replica-count   : Number of replicas per partition.
-partition-count : Number of partitions per replica.

-sdy-sharding-constraint-to-reshard

ShardingConstraintOp를 ReshardOp로 변환합니다.

-sdy-sink-data-flow-edges

모든 DataFlowEdgeOp를 입력으로 싱크합니다.

DataFlowEdgeOp의 샤딩을 입력 (가장자리의 루트 타겟)으로 이동하고 작업을 입력으로 바꿉니다.

옵션

-sink-debug-sharding-origins          : Whether to sink the debug sharding origins info. See `debug-sharding-origins` option in propagation for more info.
-sink-debug-propagation-edge-sharding : Whether to sink the debug propagation edge sharding info. See `debug-propagation-edge-sharding` option in propagation for more info.

-sdy-sink-func-data-flow-edges

모든 FuncDataFlowEdgeOp를 입력으로 싱크합니다.

FuncDataFlowEdgeOp의 샤딩을 입력으로 이동하고 작업을 입력으로 바꿉니다.

-sdy-unflatten-call-graph

호출 그래프를 펼칩니다.

그래프를 펼칩니다. 함수에 연결된 'original_func_name' 속성으로 설명된 대로 동일한 입력/출력 샤딩 동일한 출처를 가진 함수를 중복 삭제합니다.

옵션

-dedup-functions-fully : If true, regardless of the input and output shardings of functions, it keeps one callee function for each caller function. The default is false, meaning it will deduplicate only if the input and output shardings are the same.

-sdy-update-non-divisible-input-output-shardings

FuncOp 입력/출력을 균등하게 샤딩하여 나눌 수 없는 샤딩으로 인한 패딩의 필요성을 없앱니다.

Shardy 사용자는 텐서를 패딩하지 않도록 함수 입력/출력이 균등하게 나눌 수 있고 샤딩할 수 있을 것으로 예상합니다. 전파로 인해 입력/출력에 나눌 수 없는 샤딩이 있을 수 있으므로 이 패스는 균등하게 샤딩된 원래 샤딩의 가장 큰 측정기준 샤딩 접두사로 업데이트합니다.

-sdy-verify-unreduced-axes

축소되지 않은 축 사용의 일관성을 확인합니다.

모든 작업에 대해 피연산자에 축소되지 않은 축이 있는 경우 작업이 명시적으로 축소하거나 (예: sdy.reshard를 통해) 결과를 통해 전달하는지 확인합니다 (또는 func.call과 같은 경계 작업임).