Skip to content

Commit

Permalink
[Utils] Remove unused utils (nod-ai#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
newling authored and daveliddell committed Oct 7, 2024
1 parent f6e1bfd commit 7ae9d2b
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 259 deletions.
1 change: 0 additions & 1 deletion compiler/plugins/target/AMD-AIE/aie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ iree_cc_library(
::AIEDialectIR
::AIEXDialectIR
::AIENormalizeAddressSpacesGen
iree::target::amd-aie::Utils::Utils
)

add_subdirectory(test)
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ iree_compiler_register_plugin(
add_subdirectory(IR)
add_subdirectory(Target)
add_subdirectory(Transforms)
add_subdirectory(Utils)
add_subdirectory(Test/samples)
add_subdirectory(Test/OPT/failing_tests)
add_subdirectory(Test/transform_dialect)
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "iree-amd-aie/IR/AMDAIEDmaOpInterface.h"

#include "iree-amd-aie/IR/AMDAIEAttrs.h"
#include "iree-amd-aie/Utils/Utils.h"

/// Include the definitions of the dma-like interfaces.
#include "iree-amd-aie/IR/AMDAIEDmaOpInterface.cpp.inc"
Expand Down Expand Up @@ -49,35 +48,6 @@ std::optional<int64_t> getStaticBaseOffset(DoublyStridedOpInterface op) {
return baseOffset;
}

/// Utility to compute the static extent on either the source or target side
/// of a doubly strided operation. The extent is the range of elements covered
/// by the strided access pattern, starting from the base offset.
///
/// Returns std::nullopt if the extent can't be computed due to for example
/// dynamic strides or sizes.
///
/// Returns 0 in case of empty offsets/strides/sizes, which represents a
/// contiguous access of all values operated on.
template <CopyOpOperateOn OperateOn>
std::optional<int64_t> getStaticExtent(DoublyStridedOpInterface op) {
SmallVector<OpFoldResult> sizes;
SmallVector<OpFoldResult> strides;
if constexpr (OperateOn == CopyOpOperateOn::Source) {
sizes = op.getSourceMixedSizes();
strides = op.getSourceMixedStrides();
} else if constexpr (OperateOn == CopyOpOperateOn::Target) {
sizes = op.getTargetMixedSizes();
strides = op.getTargetMixedStrides();
} else {
assert(false && "Function can only operate on Source or Target");
}
std::optional<SmallVector<int64_t>> staticSizes = getConstantIntValues(sizes);
std::optional<SmallVector<int64_t>> staticStrides =
getConstantIntValues(strides);
if (!staticSizes || !staticStrides) return std::nullopt;
return getAccessRangeExtent(staticSizes.value(), staticStrides.value());
}

template <CopyOpOperateOn OperateOn>
std::optional<int64_t> getStaticSize(DoublyStridedOpInterface op) {
SmallVector<OpFoldResult> sizes;
Expand All @@ -101,11 +71,6 @@ std::optional<int64_t> getSourceStaticBaseOffset(DoublyStridedOpInterface op) {
return getStaticBaseOffset<CopyOpOperateOn::Source>(op);
}

/// Return the static access extent on the source side if it can be computed.
/// Otherwise, returns nullopt.
std::optional<int64_t> getSourceStaticExtent(DoublyStridedOpInterface op) {
return getStaticExtent<CopyOpOperateOn::Source>(op);
}

std::optional<int64_t> getSourceStaticSize(DoublyStridedOpInterface op) {
return getStaticSize<CopyOpOperateOn::Source>(op);
Expand All @@ -117,11 +82,6 @@ std::optional<int64_t> getTargetStaticBaseOffset(DoublyStridedOpInterface op) {
return getStaticBaseOffset<CopyOpOperateOn::Target>(op);
}

/// Return the static access extent on the target side if it can be computed.
/// Otherwise, returns nullopt.
std::optional<int64_t> getTargetStaticExtent(DoublyStridedOpInterface op) {
return getStaticExtent<CopyOpOperateOn::Target>(op);
}

std::optional<int64_t> getTargetStaticSize(DoublyStridedOpInterface op) {
return getStaticSize<CopyOpOperateOn::Target>(op);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ namespace detail {
/// Otherwise, returns nullopt.
std::optional<int64_t> getSourceStaticBaseOffset(DoublyStridedOpInterface op);

/// Return the static access extent on the source side if it can be computed.
/// Otherwise, returns nullopt.
std::optional<int64_t> getSourceStaticExtent(DoublyStridedOpInterface op);

/// Return the static size of the access on the source side if it can be
/// computed. Otherwise, returns nullopt.
Expand All @@ -36,10 +33,6 @@ std::optional<int64_t> getSourceStaticSize(DoublyStridedOpInterface op);
/// Otherwise, returns nullopt.
std::optional<int64_t> getTargetStaticBaseOffset(DoublyStridedOpInterface op);

/// Return the static access extent on the target side if it can be computed.
/// Otherwise, returns nullopt.
std::optional<int64_t> getTargetStaticExtent(DoublyStridedOpInterface op);

/// Return the static size of the access on the target side if it can be
/// computed. Otherwise, returns nullopt.
std::optional<int64_t> getTargetStaticSize(DoublyStridedOpInterface op);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,6 @@ def DoublyStridedOpInterface : OpInterface<"DoublyStridedOpInterface"> {
::mlir::cast<DoublyStridedOpInterface>($_op.getOperation()));
}]
>,
InterfaceMethod<
/*desc=*/[{
Return the static access range extent on the target side if it can be
computed. Otherwise, returns nullopt.

The extent is the number of elements in the range of elements being
accessed. This is the same as the last relative index (with regard to
base offset) being accessed + 1.

A return value of 0 is the result of empty offsets/strides/sizes and
represents a contiguous access of all values operated on.
}],
/*retTy=*/"std::optional<int64_t>",
/*methodName=*/"getTargetStaticExtent",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return detail::getTargetStaticExtent(
::mlir::cast<DoublyStridedOpInterface>($_op.getOperation()));
}]
>,
InterfaceMethod<
/*desc=*/[{
Return the static size of the access on the target side if it can be
Expand Down Expand Up @@ -314,27 +293,6 @@ def DoublyStridedOpInterface : OpInterface<"DoublyStridedOpInterface"> {
::mlir::cast<DoublyStridedOpInterface>($_op.getOperation()));
}]
>,
InterfaceMethod<
/*desc=*/[{
Return the static access range extent on the source side if it can be
computed. Otherwise, returns nullopt.

The extent is the number of elements in the range of elements being
accessed. This is the same as the last relative index (with regard to
base offset) being accessed + 1.

A return value of 0 is the result of empty offsets/strides/sizes and
represents a contiguous access of all values operated on.
}],
/*retTy=*/"std::optional<int64_t>",
/*methodName=*/"getSourceStaticExtent",
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
return detail::getSourceStaticExtent(
::mlir::cast<DoublyStridedOpInterface>($_op.getOperation()));
}]
>,
InterfaceMethod<
/*desc=*/[{
Return the static size of the access on the source side if it can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ iree_cc_library(
::AMDAIETypesGen
::AMDAIEAttrsGen
iree-amd-aie::aie_runtime::AMDAIEEnums
iree::target::amd-aie::Utils::Utils
LLVMSupport
MLIRArithUtils
MLIRCopyOpInterface
Expand Down
24 changes: 0 additions & 24 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Utils/CMakeLists.txt

This file was deleted.

29 changes: 0 additions & 29 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Utils/Utils.cpp

This file was deleted.

43 changes: 0 additions & 43 deletions compiler/plugins/target/AMD-AIE/iree-amd-aie/Utils/Utils.h

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 7ae9d2b

Please sign in to comment.