You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

gen_list.py 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. from generator import (
  2. GenerateGemmOperations,
  3. GenerateGemvOperations,
  4. GenerateConv2dOperations,
  5. GenerateDeconvOperations,
  6. GenerateDwconv2dFpropOperations,
  7. GenerateDwconv2dDgradOperations,
  8. GenerateDwconv2dWgradOperations,
  9. )
  10. class GenArg:
  11. def __init__(self, gen_op, gen_type):
  12. self.operations = gen_op
  13. self.type = gen_type
  14. def write_op_list(f, gen_op, gen_type):
  15. if gen_op == "gemm":
  16. operations = GenerateGemmOperations(GenArg(gen_op, gen_type))
  17. elif gen_op == "gemv":
  18. operations = GenerateGemvOperations(GenArg(gen_op, gen_type))
  19. elif gen_op == "conv2d":
  20. operations = GenerateConv2dOperations(GenArg(gen_op, gen_type))
  21. elif gen_op == "deconv":
  22. operations = GenerateDeconvOperations(GenArg(gen_op, gen_type))
  23. elif gen_op == "dwconv2d_fprop":
  24. operations = GenerateDwconv2dFpropOperations(GenArg(gen_op, gen_type))
  25. elif gen_op == "dwconv2d_dgrad":
  26. operations = GenerateDwconv2dDgradOperations(GenArg(gen_op, gen_type))
  27. elif gen_op == "dwconv2d_wgrad":
  28. operations = GenerateDwconv2dWgradOperations(GenArg(gen_op, gen_type))
  29. for op in operations:
  30. f.write(' "%s.cu",\n' % op.procedural_name())
  31. if gen_op != "gemv":
  32. f.write(' "all_%s_%s_operations.cu",\n' % (gen_op, gen_type))
  33. if __name__ == "__main__":
  34. with open("list.bzl", "w") as f:
  35. f.write("# Generated by dnn/scripts/cutlass_generator/gen_list.py\n\n")
  36. f.write("cutlass_gen_list = [\n")
  37. write_op_list(f, "gemm", "simt")
  38. write_op_list(f, "gemm", "tensorop1688")
  39. write_op_list(f, "gemm", "tensorop884")
  40. write_op_list(f, "gemv", "simt")
  41. write_op_list(f, "deconv", "simt")
  42. write_op_list(f, "deconv", "tensorop8816")
  43. write_op_list(f, "conv2d", "simt")
  44. write_op_list(f, "conv2d", "tensorop8816")
  45. write_op_list(f, "conv2d", "tensorop8832")
  46. write_op_list(f, "dwconv2d_fprop", "simt")
  47. write_op_list(f, "dwconv2d_fprop", "tensorop884")
  48. write_op_list(f, "dwconv2d_dgrad", "simt")
  49. write_op_list(f, "dwconv2d_dgrad", "tensorop884")
  50. write_op_list(f, "dwconv2d_wgrad", "simt")
  51. write_op_list(f, "dwconv2d_wgrad", "tensorop884")
  52. f.write("]")