Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Attributes and Types for VHLO #849

Merged
merged 44 commits into from
Feb 3, 2023

Conversation

GleasonK
Copy link
Member

@GleasonK GleasonK commented Dec 28, 2022

  • Change CustomCallApiVersion to an enum instead of an integer value.
    • To avoid transforming all integers, the transformation from StableHLO --> VHLO special cases this conversion
  • Attributes
    • Forked Attributes: IntegerAttr, StringAttr, UnitAttr, ArrayAttr, DenseIntOrFPElementsV1Attr, FlatSymbolRefV1Attr, FloatV1Attr
  • Types
    • Forked Types: RankedTensorType, UnrankedTensorType, TupleType, WitnessType, BFloat16V1Type, Float16V1Type, Float32V1Type, Float64V1Type, IndexV1Type, ComplexV1Type, IntegerV1Type, UniformQuantizedV1Type
  • Bytecode implementations forked from BuiltinDialectBytecode.cpp

Need a closer review on FloatAttr since it deals with numerics, I have a FIXME comment next to that line still. I may revert from forking that value so that the implementation doesn't have to deal with numeric value conversions.

Closes #674.

@GleasonK GleasonK changed the title Compat fork attrtype Fork Attributes and Types for VHLO Dec 28, 2022
@burmako burmako self-requested a review December 29, 2022 04:37
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
@burmako burmako assigned GleasonK and unassigned burmako Dec 29, 2022
@GleasonK GleasonK assigned burmako and unassigned GleasonK Jan 5, 2023
@GleasonK GleasonK force-pushed the compat-fork-attrtype branch 4 times, most recently from 62dfef2 to aac4a00 Compare January 11, 2023 23:39
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/CMakeLists.txt Show resolved Hide resolved
stablehlo/dialect/VhloBytecode.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/VhloLegalizeToStablehlo.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/VhloLegalizeToStablehlo.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/VhloLegalizeToStablehlo.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/VhloToVersion.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/VhloToVersion.cpp Outdated Show resolved Hide resolved
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloBytecode.cpp Outdated Show resolved Hide resolved
stablehlo/dialect/VhloBytecode.cpp Outdated Show resolved Hide resolved
stablehlo/transforms/TypeConversion.h Outdated Show resolved Hide resolved
stablehlo/dialect/VhloOps.cpp Outdated Show resolved Hide resolved
stablehlo/tests/vhlo_to_version_attrtype_invalid.mlir Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloAttrs.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Outdated Show resolved Hide resolved
stablehlo/tools/StablehloOptMain.cpp Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.td Show resolved Hide resolved
stablehlo/dialect/VhloTypes.h Outdated Show resolved Hide resolved
stablehlo/dialect/VhloTypes.h Outdated Show resolved Hide resolved
stablehlo/dialect/VhloDialect.h Outdated Show resolved Hide resolved
stablehlo/dialect/VhloOps.h Show resolved Hide resolved
stablehlo/dialect/VhloTypes.cpp Outdated Show resolved Hide resolved
stablehlo/dialect/CMakeLists.txt Show resolved Hide resolved
stablehlo/dialect/CMakeLists.txt Show resolved Hide resolved
stablehlo/dialect/CMakeLists.txt Show resolved Hide resolved
BUILD.bazel Outdated Show resolved Hide resolved
stablehlo/dialect/VhloDialect.h Outdated Show resolved Hide resolved
@burmako burmako assigned GleasonK and unassigned burmako Feb 3, 2023
stablehlo/dialect/VhloTypes.h Outdated Show resolved Hide resolved
stablehlo/dialect/VhloOps.cpp Show resolved Hide resolved
@burmako burmako assigned GleasonK and unassigned GleasonK Feb 3, 2023
@burmako burmako merged commit c6bf20f into openxla:main Feb 3, 2023
burmako pushed a commit that referenced this pull request Feb 8, 2023
I recently noticed this code when reviewing #849, and I'm not sure why
we need it there.

This seems like a pretty strong statement about a fundamental role of
the Tensor dialect in the workings of the StableHLO dialect, and I don't
think we have established that yet.

It would seem that we've inherited this from MHLO when bootstrapping
StableHLO (#1), but I don't think I understand the reasoning on the MHLO
side either. This change was introduced as part of an LLVM integrate
(tensorflow/mlir-hlo@ba0346b),
and the commit description doesn't go into detail about motivation.

Given that, I propose to revert this in the StableHLO dialect and see
what happens. All tests in this repository are passing, but maybe we'll
learn more after downstream integrations.
GleasonK pushed a commit to GleasonK/stablehlo that referenced this pull request Feb 8, 2023
)

I recently noticed this code when reviewing openxla#849, and I'm not sure why
we need it there.

This seems like a pretty strong statement about a fundamental role of
the Tensor dialect in the workings of the StableHLO dialect, and I don't
think we have established that yet.

It would seem that we've inherited this from MHLO when bootstrapping
StableHLO (#1), but I don't think I understand the reasoning on the MHLO
side either. This change was introduced as part of an LLVM integrate
(tensorflow/mlir-hlo@ba0346b),
and the commit description doesn't go into detail about motivation.

Given that, I propose to revert this in the StableHLO dialect and see
what happens. All tests in this repository are passing, but maybe we'll
learn more after downstream integrations.
@GleasonK GleasonK deleted the compat-fork-attrtype branch February 10, 2023 16:14
GleasonK added a commit to GleasonK/stablehlo that referenced this pull request Feb 10, 2023
- Change `CustomCallApiVersion` to an enum instead of an integer value.
+ To avoid transforming _all_ integers, the transformation from
StableHLO --> VHLO special cases this conversion
- Attributes
+ Forked Attributes: `IntegerAttr, StringAttr, UnitAttr, ArrayAttr`,
`DenseIntOrFPElementsV1Attr, FlatSymbolRefV1Attr, FloatV1Attr`
- Types
+ Forked Types: `RankedTensorType, UnrankedTensorType, TupleType,
WitnessType`, `BFloat16V1Type, Float16V1Type, Float32V1Type,
Float64V1Type, IndexV1Type, ComplexV1Type, IntegerV1Type,
UniformQuantizedV1Type`
- Bytecode implementations forked from
[BuiltinDialectBytecode.cpp](https://github.com/llvm/llvm-project/blob/c48e0cf03a50bb8a2043ac4bb5e9a83ff135247a/mlir/lib/IR/BuiltinDialectBytecode.cpp)
GleasonK pushed a commit to GleasonK/stablehlo that referenced this pull request Feb 10, 2023
)

I recently noticed this code when reviewing openxla#849, and I'm not sure why
we need it there.

This seems like a pretty strong statement about a fundamental role of
the Tensor dialect in the workings of the StableHLO dialect, and I don't
think we have established that yet.

It would seem that we've inherited this from MHLO when bootstrapping
StableHLO (#1), but I don't think I understand the reasoning on the MHLO
side either. This change was introduced as part of an LLVM integrate
(tensorflow/mlir-hlo@ba0346b),
and the commit description doesn't go into detail about motivation.

Given that, I propose to revert this in the StableHLO dialect and see
what happens. All tests in this repository are passing, but maybe we'll
learn more after downstream integrations.
atondwal pushed a commit to atondwal/stablehlo that referenced this pull request Mar 3, 2023
- Change `CustomCallApiVersion` to an enum instead of an integer value.
+ To avoid transforming _all_ integers, the transformation from
StableHLO --> VHLO special cases this conversion
- Attributes
+ Forked Attributes: `IntegerAttr, StringAttr, UnitAttr, ArrayAttr`,
`DenseIntOrFPElementsV1Attr, FlatSymbolRefV1Attr, FloatV1Attr`
- Types
+ Forked Types: `RankedTensorType, UnrankedTensorType, TupleType,
WitnessType`, `BFloat16V1Type, Float16V1Type, Float32V1Type,
Float64V1Type, IndexV1Type, ComplexV1Type, IntegerV1Type,
UniformQuantizedV1Type`
- Bytecode implementations forked from
[BuiltinDialectBytecode.cpp](https://github.com/llvm/llvm-project/blob/c48e0cf03a50bb8a2043ac4bb5e9a83ff135247a/mlir/lib/IR/BuiltinDialectBytecode.cpp)
atondwal pushed a commit to atondwal/stablehlo that referenced this pull request Mar 3, 2023
)

I recently noticed this code when reviewing openxla#849, and I'm not sure why
we need it there.

This seems like a pretty strong statement about a fundamental role of
the Tensor dialect in the workings of the StableHLO dialect, and I don't
think we have established that yet.

It would seem that we've inherited this from MHLO when bootstrapping
StableHLO (openxla#1), but I don't think I understand the reasoning on the MHLO
side either. This change was introduced as part of an LLVM integrate
(tensorflow/mlir-hlo@ba0346b),
and the commit description doesn't go into detail about motivation.

Given that, I propose to revert this in the StableHLO dialect and see
what happens. All tests in this repository are passing, but maybe we'll
learn more after downstream integrations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add forked types and attributes for VHLO
2 participants