Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
chenfucn committed Jan 30, 2024
1 parent 73679d3 commit 423aa1f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions onnxruntime/test/cuda_host/blkq4_fp16_quant_sm80.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ inline void sm80_expand_prepack_quant_offsets_ref(
ORT_ENFORCE(tensor_offset_prepacked.shape() == meta_shape,
"Unexpected tensor_offset_prepacked shape (",
tensor_offset_prepacked.shape()[0], ",", tensor_offset_prepacked.shape()[1],
")! Expected: (", meta_shape[0], ", ", meta_shape[1], ")");
")! Expected: (", meta_shape[0], ", ", meta_shape[1], ")");
ORT_ENFORCE(tensor_offset.shape() == zp_shape,
"Unexpected tensor_offset shape (",
tensor_offset.shape()[0], ",", tensor_offset.shape()[1],
Expand Down Expand Up @@ -201,8 +201,7 @@ inline void sm80_expand_prepack_quant_offsets_ref(
}

template <typename Layout, typename QuantBlocking>
inline
void sm80_prepack_quant_offsets_ref(
inline void sm80_prepack_quant_offsets_ref(
int rows,
int columns,
MatrixRef<uint8_t const, Layout, true> tensor_offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ Status sm80_supported();
* @param[out] q_zp The zero points, column major layout.
*/
template <typename ElementT, int block_size, bool col_blocking, bool has_offsets>
inline
void blkq4_weights_gen(
inline void blkq4_weights_gen(
int rows, int columns,
std::vector<ElementT>& dequants,
std::vector<uint8_t>& q_weights,
Expand Down Expand Up @@ -130,7 +129,7 @@ void blkq4_weights_gen(
q_scales, meta_shape);

MatrixRef<ElementQOffset, ColumnMajorLayout, true> tensor_offset;
if constexpr(has_offsets) {
if constexpr (has_offsets) {
q_zp.resize(zp_shape.product());
tensor_offset = MatrixRef<ElementQOffset, ColumnMajorLayout, true>(
q_zp, zp_shape);
Expand All @@ -155,7 +154,7 @@ void blkq4_weights_gen(
auto weight_cord = make_Position(row / 2, col);
auto scale_cord = make_Position(row / QuantBlocking::kRow, col / QuantBlocking::kColumn);
uint8_t offset = 8;
if constexpr(has_offsets) {
if constexpr (has_offsets) {
if (scale_cord[0] % 2 == 0) {
offset = tensor_offset.at(scale_cord[0] / 2, scale_cord[1]) & 0x0f;
} else {
Expand All @@ -175,7 +174,6 @@ void blkq4_weights_gen(
// fprintf(stderr, "(%2d,%2d)= %2d, %2d, %f, %f\n", row, col, w, offset, scale, dequant);
}
}

}

template <
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void testPrepack(int rows, int columns) {
MatrixRef<ElementT, ColumnMajorLayout, true> tensor_scale(
q_scales, meta_shape);
MatrixRef<ElementQOffset, ColumnMajorLayout, true> tensor_offset;
if constexpr(has_offset) {
if constexpr (has_offset) {
tensor_offset = MatrixRef<ElementQOffset, ColumnMajorLayout, true>(q_zp, zp_shape);
}

Expand Down Expand Up @@ -167,7 +167,7 @@ void testPrepack(int rows, int columns) {
std::vector<ElementT> packed_scales_ref(meta_shape.product());
MatrixRef<ElementT, LayoutQmeta, true> tensor_packed_s_ref =
make_MatrixRef<ElementT, LayoutQmeta, true>(packed_scales_ref, meta_shape);
if constexpr(Base::ShouldRearrangeMeta) {
if constexpr (Base::ShouldRearrangeMeta) {
onnxruntime::test::sm80_prepack_quant_scales_ref<ElementT, LayoutQmeta, QuantBlocking>(
rows, columns, tensor_scale.const_ref(), tensor_packed_s_ref);
} else {
Expand Down Expand Up @@ -197,7 +197,7 @@ void testPrepack(int rows, int columns) {
std::vector<ElementQOffset> packed_zp_ref(meta_shape.product());
MatrixRef<ElementQOffset, LayoutQmeta, true> tensor_packed_zp_ref =
make_MatrixRef<ElementQOffset, LayoutQmeta, true>(packed_zp_ref, meta_shape);
if constexpr(Base::ShouldRearrangeMeta) {
if constexpr (Base::ShouldRearrangeMeta) {
onnxruntime::test::sm80_expand_prepack_quant_offsets_ref<LayoutQmeta, QuantBlocking>(
rows, columns, tensor_offset.const_ref(), tensor_packed_zp_ref);
} else {
Expand Down

0 comments on commit 423aa1f

Please sign in to comment.