Browse Source

fix(fp16): fix midout build issue when hit fp16 trace

GitOrigin-RevId: cf2c5184cd
tags/v1.6.0-rc1
Megvii Engine Team 3 years ago
parent
commit
171d69155a
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      tools/gen_header_for_bin_reduce.py

+ 12
- 0
tools/gen_header_for_bin_reduce.py View File

@@ -185,6 +185,18 @@ class HeaderGen:
).stdout.decode('utf-8')
self._fout.write('// midout \n')
self._fout.write(cvt)
if cvt.find(" half,"):
change = open(self._fout.name).read().replace(" half,", " __fp16,")
with open("fix_fp16_bin_reduce.h", "w") as fix_fp16:
fix_fp16.write(change)
msg = (
"WARNING:\n"
"hit half in trace, try use fix_fp16_bin_reduce.h when build failed with bin_reduce.h\n"
"which caused by LLVM mangle issue on __fp16 dtype, if you find msg 'error: use of undeclared identifier 'half'\n"
"then try use fix_fp16_bin_reduce.h, if build failed again, submit a issue to Engine team!!!"
)
print(msg)


def main():
parser = argparse.ArgumentParser(


Loading…
Cancel
Save