Skip to content

Commit e43555f

Browse files
authored
[REFACTOR][DataType] Phase out target custom datatype support (#19760)
## Summary The in-tree target custom datatype path adds maintenance surface while current development focuses on core datatypes. This PR phases out the built-in registry/lowering implementation and keeps the core dtype behavior intact. - Remove the target/datatype implementation, BYODT posit build option, and related Python helpers - Remove the custom datatype lowering pass from TIRX and S-TIR finalization pipelines - Simplify remaining TIRX dtype handling back to built-in/core datatypes
1 parent 1c27ccf commit e43555f

19 files changed

Lines changed: 8 additions & 1450 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ tvm_option(USE_CCACHE "Use ccache if found when invoking compiler" AUTO)
8787
# 3rdparty libraries
8888
tvm_option(COMPILER_RT_PATH "Path to COMPILER-RT" "3rdparty/compiler-rt")
8989
# Contrib library options
90-
tvm_option(USE_BYODT_POSIT "Build with BYODT software emulated posit custom datatype" OFF)
9190
tvm_option(USE_BLAS "The blas library to be linked" none)
9291
tvm_option(USE_AMX "Enable Intel AMX" OFF)
9392
tvm_option(USE_MKL "MKL root path when use MKL blas" OFF)
@@ -356,10 +355,6 @@ tvm_file_glob(GLOB CODEGEN_SRCS
356355

357356
list(APPEND COMPILER_SRCS ${CODEGEN_SRCS})
358357

359-
tvm_file_glob(GLOB DATATYPE_SRCS src/target/datatype/*.cc)
360-
list(APPEND COMPILER_SRCS ${DATATYPE_SRCS})
361-
list(APPEND COMPILER_SRCS "src/target/datatype/myfloat/myfloat.cc")
362-
363358
tvm_file_glob(GLOB RUNTIME_SRCS
364359
src/runtime/*.cc
365360
src/runtime/vm/*.cc
@@ -464,7 +459,6 @@ include(cmake/modules/contrib/DNNL.cmake)
464459
include(cmake/modules/contrib/AMX.cmake)
465460
include(cmake/modules/contrib/CUTLASS.cmake)
466461
include(cmake/modules/contrib/Random.cmake)
467-
include(cmake/modules/contrib/Posit.cmake)
468462
include(cmake/modules/contrib/Sort.cmake)
469463
include(cmake/modules/contrib/CoreML.cmake)
470464
include(cmake/modules/contrib/TensorRT.cmake)

cmake/modules/contrib/Posit.cmake

Lines changed: 0 additions & 26 deletions
This file was deleted.

docker/Dockerfile.ci_cpu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ RUN bash /install/ubuntu_install_dnnl.sh
6363
COPY install/ubuntu_install_xgboost.sh /install/ubuntu_install_xgboost.sh
6464
RUN bash /install/ubuntu_install_xgboost.sh
6565

66-
# BYODT deps
67-
COPY install/ubuntu_install_universal.sh /install/ubuntu_install_universal.sh
68-
RUN bash /install/ubuntu_install_universal.sh
69-
7066
# TensorFlow deps
7167
COPY install/ubuntu_install_tensorflow.sh /install/ubuntu_install_tensorflow.sh
7268
RUN bash /install/ubuntu_install_tensorflow.sh

docker/Dockerfile.ci_gpu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ RUN bash /install/ubuntu_install_vulkan.sh
115115
COPY install/ubuntu_install_xgboost.sh /install/ubuntu_install_xgboost.sh
116116
RUN bash /install/ubuntu_install_xgboost.sh
117117

118-
# BYODT deps
119-
COPY install/ubuntu_install_universal.sh /install/ubuntu_install_universal.sh
120-
RUN bash /install/ubuntu_install_universal.sh
121-
122118
# sccache
123119
COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh
124120
RUN bash /install/ubuntu_install_sccache.sh

include/tvm/tirx/op.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -998,13 +998,6 @@ inline PrimExpr MakeConstScalar(DataType t, ValueType value, Span span = Span())
998998
}
999999
if (t.is_float() || t.is_bfloat16() || t.is_float8() || t.is_float6() || t.is_float4())
10001000
return FloatImm(t, static_cast<double>(value), span);
1001-
// For now, we store const scalar values of custom datatypes within doubles; later, during the
1002-
// datatypes lowering pass, we will lower the value to its true representation in the format
1003-
// specified by the datatype.
1004-
// TODO(gus) when do we need to start worrying about doubles not being precise enough?
1005-
if (static_cast<uint8_t>(t.code()) >= static_cast<uint8_t>(DataType::kCustomBegin)) {
1006-
return FloatImm(t, static_cast<double>(value), span);
1007-
}
10081001
TVM_FFI_THROW(InternalError) << "cannot make const for type " << t;
10091002
throw;
10101003
}

include/tvm/tirx/transform.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ TVM_DLL Pass MakePackedAPI();
153153
*/
154154
TVM_DLL Pass RemapThreadAxis(ffi::Map<ffi::String, IterVar> axis_map);
155155

156-
/*!
157-
* \brief Lower custom datatypes.
158-
*
159-
* See tvm::datatypes::Registry for more information on adding custom datatypes.
160-
*
161-
* \return The pass.
162-
*/
163-
TVM_DLL Pass LowerCustomDatatypes();
164-
165156
/*!
166157
* \brief Annotate, split, and lower host/device functions.
167158
*

python/tvm/s_tir/pipeline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def finalize_host_passes(): # pylint: disable=unused-argument
125125
"""The default finalization passes for TIR backend."""
126126
host_pass_list = [
127127
tirx.transform.LowerTVMBuiltin(),
128-
tirx.transform.LowerCustomDatatypes(),
129128
tirx.transform.LowerIntrin(),
130129
]
131130
return tvm.ir.transform.Sequential(host_pass_list)
@@ -136,7 +135,6 @@ def finalize_device_passes(): # pylint: disable=unused-argument
136135
device_pass_list = [
137136
tirx.transform.LowerWarpMemory(),
138137
tirx.transform.StmtSimplify(),
139-
tirx.transform.LowerCustomDatatypes(),
140138
tirx.transform.LowerIntrin(),
141139
]
142140
return tvm.ir.transform.Sequential(device_pass_list)

python/tvm/target/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@
3434
from .target import Target, TargetKind
3535
from .virtual_device import VirtualDevice
3636
from .tag import list_tags, register_tag
37-
from . import datatype
3837
from . import codegen
3938
from . import tag_registry # registers tags on import

0 commit comments

Comments
 (0)