MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / main

Function main

examples/cpp/decoding/layernorm_test.cc:88–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86void add_bias_residual_layernorm_test(const int m, const int n);
87
88int main(int argc, char** argv)
89{
90 if (argc != 4) {
91 printf("[ERROR] layernorm_test max_m max_n data_type\n");
92 printf("e.g., ./bin/layernorm_test 1 1024 1\n");
93 return 0;
94 }
95
96 int max_m = atoi(argv[1]);
97 int max_n = atoi(argv[2]);
98 const FtCudaDataType data_type = static_cast<FtCudaDataType>(atoi(argv[3])); // 0 FP32, 1 FP16, 2 BF 16
99
100 for (int m = 1; m <= max_m; m *= 2) {
101 for (int n = 128; n <= max_n; n *= 2) {
102 if (data_type == FP16) {
103 add_bias_residual_layernorm_test<half>(m, n);
104 }
105#ifdef ENABLE_BF16
106 else if (data_type == BF16) {
107 add_bias_residual_layernorm_test<__nv_bfloat16>(m, n);
108 }
109#endif
110 else if (data_type == FP32) {
111 add_bias_residual_layernorm_test<float>(m, n);
112 }
113 else {
114 FT_LOG_ERROR("data_type should be fp32, fp16 or bf16!");
115 exit(-1);
116 }
117 }
118 }
119 return 0;
120}
121

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected