compiler-optimization

How to remove -pthread compiler flag from cython setup file

此生再无相见时 提交于 2020-06-07 06:44:56
问题 In linux environment, when I run the setup script for cython, I get gcc -pthread -B /apps/.../compiler_compat -Wl,-sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/ap...... for my case, I want to remove the pthread option. How do I do that thru the cython setup file? I see there are options to add compiler flags but none to remove. My setup file: from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension

How to remove -pthread compiler flag from cython setup file

与世无争的帅哥 提交于 2020-06-07 06:42:57
问题 In linux environment, when I run the setup script for cython, I get gcc -pthread -B /apps/.../compiler_compat -Wl,-sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/ap...... for my case, I want to remove the pthread option. How do I do that thru the cython setup file? I see there are options to add compiler flags but none to remove. My setup file: from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension

App crash , Xcode11.4, iOS 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s)

不羁岁月 提交于 2020-05-25 07:08:40
问题 Our app crash on os 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s 32) compiled by Xcode 11.4, swift optimization on. We find the PC register point to a hole address without virtual address and no stack information. If we close swift optimization, it works. So do anyone find the problem and any solution? It's certain that it's related to Xcode 11.4 swift optimization. I find the same question here. https://www.reddit.com/r/iOSProgramming/comments/frcpsc/xcode_114_builds_crashes_on_ios_10/ Incident

App crash , Xcode11.4, iOS 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s)

左心房为你撑大大i 提交于 2020-05-25 07:08:11
问题 Our app crash on os 10.3.3 10.3.4, iPhone 5c /5 iPad4 (armv7s 32) compiled by Xcode 11.4, swift optimization on. We find the PC register point to a hole address without virtual address and no stack information. If we close swift optimization, it works. So do anyone find the problem and any solution? It's certain that it's related to Xcode 11.4 swift optimization. I find the same question here. https://www.reddit.com/r/iOSProgramming/comments/frcpsc/xcode_114_builds_crashes_on_ios_10/ Incident

Does compiler use SSE instructions for a regular C code?

北慕城南 提交于 2020-05-24 20:34:07
问题 I see people using -msse -msse2 -mfpmath=sse flags by default hoping that this will improve performance. I know that SSE gets engaged when special vector types are used in the C code. But do these flags make any difference for regular C code? Does compiler use SSE to optimize regular C code? 回答1: Yes, modern compilers auto-vectorize with SSE2 if you compile with full optimization. clang enables it even at -O2, gcc at -O3. Even at -O1 or -Os, compilers will use SIMD load/store instructions to

Traversal of Bounding Volume Hierachy in Shaders

ぐ巨炮叔叔 提交于 2020-05-13 05:30:05
问题 I am working on a path tracer using vulkan compute shaders. I implemented a tree representing a bounding volume hierachy. The idea of the BVH is to minimize the amount of objects a ray intersection test needs to be performed on. #1 Naive Implementation My first implementation is very fast, it traverses the tree down to a single leaf of the BVH tree. However, the ray might intersect multiple leaves. This code then leads to some triangles not being rendered (although they should). int box_index

Do C++ compilers optimize repeated function calls?

家住魔仙堡 提交于 2020-05-13 05:18:06
问题 Do compilers (generally or in particular) optimize repeated function calls? For example, consider this case. struct foo { member_type m; return_type f() const; // returns by value }; The function definition is in one translation unit return_type foo::f() const { /* do some computation using the value of m */ /* return by value */ } Repeated function calls are in another unit foo bar; some_other_function_a(bar.f()); some_other_function_b(bar.f()); Would the code in the second translation unit

How can I resolve data dependency in pointer arrays?

旧巷老猫 提交于 2020-05-12 03:17:00
问题 If we have an array of integer pointers which all pointing to the same int, and loop over it doing ++ operation, it'll be 100% slower than those pointers pointing to two different ints. Here is a concrete example int* data[2]; int a, b; a = b = 0; for (auto i = 0ul; i < 2; ++i) { // Case 3: 2.5 sec data[i] = &a; // Case 2: 1.25 sec // if (i & 1) // data[i] = &a; // else // data[i] = &b; } for (auto i = 0ul; i < 1000000000; ++i) { // Case 1: 0.5sec // asm volatile("" : "+g"(i)); // deoptimize

How can I resolve data dependency in pointer arrays?

感情迁移 提交于 2020-05-12 03:14:36
问题 If we have an array of integer pointers which all pointing to the same int, and loop over it doing ++ operation, it'll be 100% slower than those pointers pointing to two different ints. Here is a concrete example int* data[2]; int a, b; a = b = 0; for (auto i = 0ul; i < 2; ++i) { // Case 3: 2.5 sec data[i] = &a; // Case 2: 1.25 sec // if (i & 1) // data[i] = &a; // else // data[i] = &b; } for (auto i = 0ul; i < 1000000000; ++i) { // Case 1: 0.5sec // asm volatile("" : "+g"(i)); // deoptimize

Is this “elision failure” language-mandated?

自闭症网瘾萝莉.ら 提交于 2020-04-13 03:53:08
问题 Consider the following code: #include <utility> #include <string> int bar() { std::pair<int, std::string> p { 123, "Hey... no small-string optimization for me please!" }; return p.first; } (simplified thanks to @Jarod42 :-) ...) I expect the function to be implemented as simply: bar(): mov eax, 123 ret but instead, the implementation calls operator new() , constructs an std::string with my literal, then calls operator delete() . At least - that's what gcc 9 and clang 9 do (GodBolt). Here's