华为计算微信公众号
华为计算微博
华为计算今日头条
源文件目录路径如下:
TEST ├── bcfile │ └── radiosity_base.bc ├── conf_ex1.data ├── conf_ex2.data ├── cornellbox5_ex2.png ├── Makefile ├── Makefile.bk ├── matrix-check │ ├── matrix-check_20240903143531_a7df.csv │ ├── matrix-check_20240903143531_a7df.html │ ├── matrix-check_20240903143606_c2c3.csv │ └── matrix-check_20240903143606_c2c3.html ├── radiosity_base ├── radiosity_base.cpp └── radiosity_base.o
执行矩阵化检查:
devkit advisor matrix-check -i /home/TEST -c make -b make -p domain -m compute Executing matricization check task, please wait... Current progress: ################################# [100%] Scanned time: 2024/09/03 14:36:06 Configuration: Scan source code path: /home/TEST Generate report path: /home/TEST/matrix-check Generate report type: all Task Timeout Interval: The timeout period is not set. Log level: info Summary: Scanned 0 files, there are 0 sugguestions. For the details information, please check: /home/TEST/matrix-check/matrix-check_20240903143606_c2c3.html /home/TEST/matrix-check/matrix-check_20240903143606_c2c3.csv
执行向量化检查:
devkit advisor vec-check -i /home/TEST -f /home/TEST/bcfile -c 'make' -p clang -l 0 debug: Enter the second level command: advisor Executing Vector Check task, please wait... Current progress: [0%]Start generate the compile log. Generate the compile log succeed. Current progress: ################################# [100%] Scanned time: 2024/09/03 14:25:24 Configuration: Scan bc files path: /home/TEST/bcfile Scan source code path: /home/TEST Command: make Compiler: clang EnableSVE: false Generate report path: /home/TEST Generate report type: all Task Timeout Interval: The timeout period is not set. Log level: debug Summary: Scanned 1 bc files, there are 0 recommended modifications. For the details information, please check: /home/TEST/vec-check_20240903142524_180f.json /home/TEST/vec-check_20240903142524_180f.html /home/TEST/vec-check_20240903142524_180f.csv
源代码中有一段计算应该是可以被检查出来可以向量化的:
Color* render_view(const Camera& camera, const std::vector<Patch>& scene, const int width, const int height) { Color* image = new Color[width * height]; double* zbuffer = new double[width * height]; for (int i = 0; i < width * height; ++i) { image[i] = Color(); zbuffer[i] = 1000000; } for (const auto& p : scene) { if (Length(p.pos + 0.5 * (p.a + p.b) - camera.pos) < 1e-6) continue; Vector a = camera.project(p.pos); Vector b = camera.project(p.pos + p.a); Vector c = camera.project(p.pos + p.b); Vector d = camera.project(p.pos + p.a + p.b); if (a.z < 1e-6 || b.z < 1e-6 || c.z < 1e-6 || d.z < 1e-6)continue; double px = camera.width / width; double py = camera.height / height; for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { double cx = (j + 0.5) * px - camera.width * 0.5; double cy = (i + 0.5) * py - camera.height * 0.5; double depth = 1000000; if (inside_quadrilateral(cx, cy, a, b, c, d, depth)) { if (depth < zbuffer[i * width + j] && depth > 1e-6) { image[i * width + j] = p.excident; zbuffer[i * width + j] = depth; } } } } } delete[] zbuffer; return image; }
请问是什么问题?
我要发帖子
源文件目录路径如下:
执行矩阵化检查:
devkit advisor matrix-check -i /home/TEST -c make -b make -p domain -m compute Executing matricization check task, please wait... Current progress: ################################# [100%] Scanned time: 2024/09/03 14:36:06 Configuration: Scan source code path: /home/TEST Generate report path: /home/TEST/matrix-check Generate report type: all Task Timeout Interval: The timeout period is not set. Log level: info Summary: Scanned 0 files, there are 0 sugguestions. For the details information, please check: /home/TEST/matrix-check/matrix-check_20240903143606_c2c3.html /home/TEST/matrix-check/matrix-check_20240903143606_c2c3.csv执行向量化检查:
devkit advisor vec-check -i /home/TEST -f /home/TEST/bcfile -c 'make' -p clang -l 0 debug: Enter the second level command: advisor Executing Vector Check task, please wait... Current progress: [0%]Start generate the compile log. Generate the compile log succeed. Current progress: ################################# [100%] Scanned time: 2024/09/03 14:25:24 Configuration: Scan bc files path: /home/TEST/bcfile Scan source code path: /home/TEST Command: make Compiler: clang EnableSVE: false Generate report path: /home/TEST Generate report type: all Task Timeout Interval: The timeout period is not set. Log level: debug Summary: Scanned 1 bc files, there are 0 recommended modifications. For the details information, please check: /home/TEST/vec-check_20240903142524_180f.json /home/TEST/vec-check_20240903142524_180f.html /home/TEST/vec-check_20240903142524_180f.csv源代码中有一段计算应该是可以被检查出来可以向量化的:
Color* render_view(const Camera& camera, const std::vector<Patch>& scene, const int width, const int height) { Color* image = new Color[width * height]; double* zbuffer = new double[width * height]; for (int i = 0; i < width * height; ++i) { image[i] = Color(); zbuffer[i] = 1000000; } for (const auto& p : scene) { if (Length(p.pos + 0.5 * (p.a + p.b) - camera.pos) < 1e-6) continue; Vector a = camera.project(p.pos); Vector b = camera.project(p.pos + p.a); Vector c = camera.project(p.pos + p.b); Vector d = camera.project(p.pos + p.a + p.b); if (a.z < 1e-6 || b.z < 1e-6 || c.z < 1e-6 || d.z < 1e-6)continue; double px = camera.width / width; double py = camera.height / height; for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { double cx = (j + 0.5) * px - camera.width * 0.5; double cy = (i + 0.5) * py - camera.height * 0.5; double depth = 1000000; if (inside_quadrilateral(cx, cy, a, b, c, d, depth)) { if (depth < zbuffer[i * width + j] && depth > 1e-6) { image[i * width + j] = p.excident; zbuffer[i * width + j] = depth; } } } } } delete[] zbuffer; return image; }请问是什么问题?