File tree Expand file tree Collapse file tree
lib/Dialect/Tpu/Canonicalize Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626if [ -n " $c_files " ]; then
2727 echo " Running clang-format on staged files..."
2828 clang-format -i $c_files
29- if ! git diff --quiet; then
29+ if ! git diff --quiet -- $c_files ; then
3030 echo -e " ${RED} Warning${NC} : Some cpp files were formatted. Please review the changes and then commit it again."
31- # git add $files
31+ # git add $c_files
3232 exit 1
3333 fi
3434fi
@@ -43,9 +43,9 @@ if [ -n "$py_files" ]; then
4343 echo -e " ${RED} ERROR${NC} : yapf failed. Please check your code"
4444 exit 1
4545 fi
46- if ! git diff --quiet; then
46+ if ! git diff --quiet -- $py_files ; then
4747 echo -e " ${RED} Warning${NC} : Some python files were formatted. Please review the changes and then commit it again."
48- # git add $files
48+ # git add $py_files
4949 exit 1
5050 fi
5151fi
Original file line number Diff line number Diff line change @@ -403,9 +403,6 @@ struct A16MatMulToGroup : public OpRewriterPatternEx<tpu::A16MatMulOp> {
403403 if (group_size > 0 ) {
404404 return failure ();
405405 }
406- if (op.getWeightBits () != 8 ) {
407- return failure ();
408- }
409406
410407 auto scaleOp = op.getScale ().getDefiningOp <top::WeightOp>();
411408 auto zpOp = op.getZp ().getDefiningOp <top::WeightOp>();
@@ -421,7 +418,7 @@ struct A16MatMulToGroup : public OpRewriterPatternEx<tpu::A16MatMulOp> {
421418 return failure ();
422419 }
423420 auto weightShape = module::getShape (op.getWeight ());
424- int K = weightShape[1 ];
421+ int K = weightShape[1 ] * ( 8 / op. getWeightBits ()) ;
425422 int tile = K / 128 ;
426423 std::vector<int64_t > scale_shape = module::getShape (scaleOp.getResult ());
427424 std::vector<int64_t > zp_shape = module::getShape (zpOp.getResult ());
You can’t perform that action at this time.
0 commit comments