You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new function getPrecisionOfProducerConsumerTensorsBit calculates precision in bits, but the test cases in tests/cpp/test_gpu3.cpp and tests/cpp/test_low_precision_recipe.cpp still use byte-based expectations. Ensure that the test cases are updated to reflect the new bit-based precision calculations.
getPrecisionOfProducerConsumerTensorsBit(UnaryOp* uop) {
NVF_CHECK(uop != nullptr);
NVF_CHECK(
uop->getUnaryOpType() == UnaryOpType::Cast,
"Invalid expr: ",
uop->toString());
auto inp_tv = ir_utils::getTvInput(uop);
auto out_tv = ir_utils::getTvOutput(uop);
if (inp_tv == nullptr || out_tv == nullptr) {
return std::nullopt;
}
auto inp_dtype = inp_tv->dtype().type;
auto out_dtype = out_tv->dtype().type;
auto inp_prim_type = std::get_if<PrimDataType>(&inp_dtype);
auto out_prim_type = std::get_if<PrimDataType>(&out_dtype);
if (inp_prim_type == nullptr || out_prim_type == nullptr ||
*inp_prim_type == PrimDataType::Index ||
*out_prim_type == PrimDataType::Index) {
return std::nullopt;
}
returnstd::make_pair(
primDataTypeSizeBit(*inp_prim_type), primDataTypeSizeBit(*out_prim_type));
}
The new function getProducerConsumerPrecisionBit has a misleading name as it returns a pair of precision values in bits, not a single bit value. Consider renaming the function to better reflect its purpose.
The abs function template is defined for all types, but then specialized for __half and __bfloat. This can lead to ambiguity or unexpected behavior. Consider using SFINAE or overloading instead of templating.
template <typename T>
__device__ T abs(T a) {
return a > 0 ? a : -a;
}
__device__ __half abs(__half a) {
return__float2half(fabs(__half2float(a)));
}
__device__ __bfloat abs(__bfloat a) {
return__float2bfloat(fabs(__bfloat2float(a)));
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With #4852 fixed