[QST] Lots of "incomplete type is not allowed" when changing ElementInput type from int4 to half
I adapted from the CUTLASS conv2d example, and tried to change it to run with float16 and on sm86:
Environment: CUDA Version: 12.0 Device: A10
using ElementAccumulator = float; // Data type of accumulator
using ElementComputeEpilogue = float; // Data type of epilogue computation (alpha, beta)
using ElementInputA = cutlass::half_t; // Data type of elements in input tensor
using ElementInputB = cutlass::half_t; // Data type of elements in input tensor
using ElementOutput = cutlass::half_t; // Data type of elements in output tensor
using LayoutInputA = cutlass::layout::TensorNHWC;
using LayoutInputB = cutlass::layout::TensorNHWC;
using LayoutOutput = cutlass::layout::TensorNHWC;
// This code section describes whether you want to use tensor cores or regular SIMT cores on GPU SM
using MMAOp = cutlass::arch::OpClassTensorOp;
// This code section describes CUDA SM architecture number
using SmArch = cutlass::arch::Sm86;
// This code section describes the tile size a thread block will compute
using ThreadblockShape = cutlass::gemm::GemmShape<128, 128, 128>; // Threadblock tile shape
// This code section describes tile size a warp will compute
using WarpShape = cutlass::gemm::GemmShape<64, 64, 128>; // Warp tile shape
// This code section describes the size of MMA op
using InstructionShape = cutlass::gemm::GemmShape<16, 8, 16>; // TensorCore instruction shape
// This code section describes how threadblocks are scheduled on GPU
using SwizzleThreadBlock = cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>;
// Number of pipelines you want to use
constexpr int NumStages = 2;
// This code section describes the epilogue part of the kernel, we use default value
using EpilogueOp = cutlass::epilogue::thread::LinearCombinationClamp<
ElementOutput, // Data type of output matrix.
8, // The number of elements per vectorized.
// memory access. This becomes the vector width of
// math instructions in the epilogue too.
ElementAccumulator, // Data type of accumulator
ElementComputeEpilogue>; // Data type for alpha/beta in linear combination
using Conv2dFpropKernel = typename cutlass::conv::kernel::DefaultConv2dFprop<
ElementInputA, LayoutInputA,
ElementInputB, LayoutInputB,
ElementOutput, LayoutOutput,
ElementAccumulator,
MMAOp,
SmArch,
ThreadblockShape,
WarpShape,
InstructionShape,
EpilogueOp,
SwizzleThreadBlock,
NumStages,
cutlass::arch::OpMultiplyAddSaturate,
cutlass::conv::IteratorAlgorithm::kAnalytic
>::Kernel;
using ImplicitGemm = cutlass::conv::device::ImplicitGemmConvolution<Conv2dFpropKernel>;
However, it pops out lots of "incomplete type is not allowed" errors. Here are some of them.
/data/home/yibolu/mbig/cutlass/include/cutlass/conv/kernel/implicit_gemm_convolution.h(91): error: incomplete type is not allowed
detected during:
instantiation of class "cutlass::conv::kernel::ImplicitGemmConvolution<Mma_, Epilogue_, ThreadblockSwizzle_, ConvOperator, ConvProblemSize_, GroupMode_> [with Mma_=cutlass::conv::threadblock::ImplicitGemmPipelined<ThreadblockShape, cutlass::conv::threadblock::TileIterator<cutlass::conv::threadblock::Conv2dFpropActivationTileAccessIteratorAnalytic<cutlass::MatrixShape<128, 128>, ElementInputA, LayoutInputA, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, cutlass::AlignedArray<ElementInputA, 4, 16>, cutlass::conv::GroupMode::kNone>>, cutlass::transform::threadblock::RegularTileIterator<cutlass::MatrixShape<128, 128>, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, 0, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, 16>, cutlass::conv::threadblock::TileIterator<cutlass::conv::threadblock::Conv2dFpropFilterTileAccessIteratorAnalytic<cutlass::MatrixShape<128, 128>, ElementInputB, LayoutInputB, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, cutlass::AlignedArray<ElementInputA, 4, 16>, cutlass::conv::GroupMode::kNone>>, cutlass::transform::threadblock::RegularTileIterator<cutlass::MatrixShape<128, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, 1, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, 16>, ElementOutput, LayoutOutput, cutlass::gemm::threadblock::MmaPolicy<cutlass::gemm::warp::MmaTensorOp<WarpShape, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, ElementAccumulator, cutlass::layout::RowMajor, cutlass::gemm::warp::MmaTensorOpPolicy<cutlass::arch::Mma<InstructionShape, 32, ElementInputA, cutlass::layout::RowMajor, ElementInputB, cutlass::layout::ColumnMajor, ElementAccumulator, cutlass::layout::RowMajor, cutlass::arch::OpMultiplyAddSaturate>, cutlass::MatrixShape<1, 1>>, 1, false, bool>, cutlass::MatrixShape<0, 0>, cutlass::MatrixShape<0, 0>, 1>, cutlass::NumericArrayConverter<ElementInputA, ElementInputA, 128, cutlass::FloatRoundStyle::round_to_nearest, cutlass::transform::thread::UnaryTransform::Identity>, cutlass::NumericArrayConverter<ElementInputA, ElementInputA, 128, cutlass::FloatRoundStyle::round_to_nearest, cutlass::transform::thread::UnaryTransform::Identity>, bool>, Epilogue_=cutlass::epilogue::threadblock::Epilogue<ThreadblockShape, cutlass::gemm::warp::MmaTensorOp<WarpShape, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, ElementAccumulator, cutlass::layout::RowMajor, cutlass::gemm::warp::MmaTensorOpPolicy<cutlass::arch::Mma<InstructionShape, 32, ElementInputA, cutlass::layout::RowMajor, ElementInputB, cutlass::layout::ColumnMajor, ElementAccumulator, cutlass::layout::RowMajor, cutlass::arch::OpMultiplyAddSaturate>, cutlass::MatrixShape<1, 1>>, 1, false, bool>, 1, cutlass::epilogue::threadblock::PredicatedTileIterator<cutlass::epilogue::threadblock::OutputTileOptimalThreadMap<cutlass::epilogue::threadblock::OutputTileShape<128, 8, 2, 1, 1>, cutlass::epilogue::threadblock::OutputTileShape<1, 8, 1, 1, 8>, 128, 8, 32>, ElementOutput, false, cutlass::layout::NoPermute, false>, cutlass::epilogue::warp::FragmentIteratorComplexTensorOp<WarpShape, <error-type>, <error-type>, <error-type>, cutlass::layout::RowMajor>, cutlass::epilogue::warp::TileIteratorTensorOp<WarpShape, <error-type>, ElementAccumulator, cutlass::layout::RowMajor>, cutlass::epilogue::threadblock::SharedLoadIterator<cutlass::epilogue::threadblock::OutputTileOptimalThreadMap<cutlass::epilogue::threadblock::OutputTileShape<128, 8, 2, 1, 1>, cutlass::epilogue::threadblock::OutputTileShape<1, 8, 1, 1, 8>, 128, 8, 32>::CompactedThreadMap, ElementAccumulator, 32>, EpilogueOp, cutlass::MatrixShape<0, 8>, 1, 1>, ThreadblockSwizzle_=SwizzleThreadBlock, ConvOperator=cutlass::conv::Operator::kFprop, ConvProblemSize_=cutlass::conv::Conv2dProblemSize, GroupMode_=cutlass::conv::GroupMode::kNone]"
/data/home/yibolu/mbig/cutlass/include/cutlass/conv/device/implicit_gemm_convolution.h(57): here
instantiation of class "cutlass::conv::device::ImplicitGemmConvolution<ImplicitGemmKernel_> [with ImplicitGemmKernel_=Conv2dFpropKernel]"
/data/home/yibolu/mbig/cutlass/examples/09_turing_tensorop_conv2dfprop/turing_tensorop_conv2dfprop.cu(508): here
/data/home/yibolu/mbig/cutlass/include/cutlass/conv/kernel/implicit_gemm_convolution.h(98): error: incomplete type is not allowed
detected during:
instantiation of class "cutlass::conv::kernel::ImplicitGemmConvolution<Mma_, Epilogue_, ThreadblockSwizzle_, ConvOperator, ConvProblemSize_, GroupMode_> [with Mma_=cutlass::conv::threadblock::ImplicitGemmPipelined<ThreadblockShape, cutlass::conv::threadblock::TileIterator<cutlass::conv::threadblock::Conv2dFpropActivationTileAccessIteratorAnalytic<cutlass::MatrixShape<128, 128>, ElementInputA, LayoutInputA, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, cutlass::AlignedArray<ElementInputA, 4, 16>, cutlass::conv::GroupMode::kNone>>, cutlass::transform::threadblock::RegularTileIterator<cutlass::MatrixShape<128, 128>, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, 0, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, 16>, cutlass::conv::threadblock::TileIterator<cutlass::conv::threadblock::Conv2dFpropFilterTileAccessIteratorAnalytic<cutlass::MatrixShape<128, 128>, ElementInputB, LayoutInputB, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, cutlass::AlignedArray<ElementInputA, 4, 16>, cutlass::conv::GroupMode::kNone>>, cutlass::transform::threadblock::RegularTileIterator<cutlass::MatrixShape<128, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, 1, cutlass::transform::PitchLinearWarpRakedThreadMap<cutlass::PitchLinearShape<128, 128>, 128, cutlass::PitchLinearShape<32, 1>, 4>, 16>, ElementOutput, LayoutOutput, cutlass::gemm::threadblock::MmaPolicy<cutlass::gemm::warp::MmaTensorOp<WarpShape, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, ElementAccumulator, cutlass::layout::RowMajor, cutlass::gemm::warp::MmaTensorOpPolicy<cutlass::arch::Mma<InstructionShape, 32, ElementInputA, cutlass::layout::RowMajor, ElementInputB, cutlass::layout::ColumnMajor, ElementAccumulator, cutlass::layout::RowMajor, cutlass::arch::OpMultiplyAddSaturate>, cutlass::MatrixShape<1, 1>>, 1, false, bool>, cutlass::MatrixShape<0, 0>, cutlass::MatrixShape<0, 0>, 1>, cutlass::NumericArrayConverter<ElementInputA, ElementInputA, 128, cutlass::FloatRoundStyle::round_to_nearest, cutlass::transform::thread::UnaryTransform::Identity>, cutlass::NumericArrayConverter<ElementInputA, ElementInputA, 128, cutlass::FloatRoundStyle::round_to_nearest, cutlass::transform::thread::UnaryTransform::Identity>, bool>, Epilogue_=cutlass::epilogue::threadblock::Epilogue<ThreadblockShape, cutlass::gemm::warp::MmaTensorOp<WarpShape, ElementInputA, cutlass::layout::RowMajorTensorOpMultiplicandCrosswise<32, 128>, ElementInputB, cutlass::layout::ColumnMajorTensorOpMultiplicandCrosswise<32, 128>, ElementAccumulator, cutlass::layout::RowMajor, cutlass::gemm::warp::MmaTensorOpPolicy<cutlass::arch::Mma<InstructionShape, 32, ElementInputA, cutlass::layout::RowMajor, ElementInputB, cutlass::layout::ColumnMajor, ElementAccumulator, cutlass::layout::RowMajor, cutlass::arch::OpMultiplyAddSaturate>, cutlass::MatrixShape<1, 1>>, 1, false, bool>, 1, cutlass::epilogue::threadblock::PredicatedTileIterator<cutlass::epilogue::threadblock::OutputTileOptimalThreadMap<cutlass::epilogue::threadblock::OutputTileShape<128, 8, 2, 1, 1>, cutlass::epilogue::threadblock::OutputTileShape<1, 8, 1, 1, 8>, 128, 8, 32>, ElementOutput, false, cutlass::layout::NoPermute, false>, cutlass::epilogue::warp::FragmentIteratorComplexTensorOp<WarpShape, <error-type>, <error-type>, <error-type>, cutlass::layout::RowMajor>, cutlass::epilogue::warp::TileIteratorTensorOp<WarpShape, <error-type>, ElementAccumulator, cutlass::layout::RowMajor>, cutlass::epilogue::threadblock::SharedLoadIterator<cutlass::epilogue::threadblock::OutputTileOptimalThreadMap<cutlass::epilogue::threadblock::OutputTileShape<128, 8, 2, 1, 1>, cutlass::epilogue::threadblock::OutputTileShape<1, 8, 1, 1, 8>, 128, 8, 32>::CompactedThreadMap, ElementAccumulator, 32>, EpilogueOp, cutlass::MatrixShape<0, 8>, 1, 1>, ThreadblockSwizzle_=SwizzleThreadBlock, ConvOperator=cutlass::conv::Operator::kFprop, ConvProblemSize_=cutlass::conv::Conv2dProblemSize, GroupMode_=cutlass::conv::GroupMode::kNone]"
/data/home/yibolu/mbig/cutlass/include/cutlass/conv/device/implicit_gemm_convolution.h(57): here
instantiation of class "cutlass::conv::device::ImplicitGemmConvolution<ImplicitGemmKernel_> [with ImplicitGemmKernel_=Conv2dFpropKernel]"
/data/home/yibolu/mbig/cutlass/examples/09_turing_tensorop_conv2dfprop/turing_tensorop_conv2dfprop.cu(508): here
How should I fix this?
every data type has its own sets of usable threadblock/warp/instruction shapes. just change the data type without changing tile size is not enough.
as to fp16's tile shapes, you could check this unit test file https://github.com/NVIDIA/cutlass/blob/main/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sm80.cu
@yibolu96 is your issue resolved?
This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.
Closing due to inactivity. Please reopen if needed
Hello,
I am running example at cutlass/examples/58_ada_fp8_gemm. If I can change ElementA, ElementB, ElementC to cutlass::half_t, which was originally cutlass::float_e4m3_t, more than 100s of errors occurs. I assume from this post that this might be related to tile shapes. However, I cannot find appropriate tile size for ada architecture. Can you give me any advice on what would be the problem? I am attaching my error log.
Thanks!
Hi, @haeunlee22 . The template parameters for the GEMM in example 58 are currently set specifically for an Ada FP8 GEMM (e.g., instruction shape is 16x8x32). You'll need to change other template parameters to fit cutlass::half_t.
If you are running on Ada, you can simply use the template parameters we use for SM80 cutlass::half_t kernels. Examples of these are here.
Thank your for reponse!
I have changed like following as you have mentioned but I am still getting the "incomplete type is not allowed " error.
- Alignment size of A and B to 8
- A, B datatype to cutlass::half_t and output data type to float
- Three gemm tile shapes of utlass::gemm::GemmShape<128, 256, 64>, cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>
I am attaching my source and changed error log which to me looks similar.
Thank you!
@haeunlee22, the issue is that this example uses cutlass::arch::OpMultiplyAddFastAccum, which is only used for SM89 FP8 kernels.
Your example will compile if you comment out these two lines: https://github.com/NVIDIA/cutlass/blob/7d49e6c7e2f8896c47f586706e67e1fb215529dc/examples/58_ada_fp8_gemm/ada_fp8_gemm.cu#L816-L817