Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root797345yAlso: yes. Tags are important, and another place for content! They aren't in guaranteed order, though. 🙁
-
Well, calculated indices do make sense to me.. Except I'd use a descriptive method to calculate them rather than inlining all the logic
-
@endor
And the only explanation is one comment that gives the formula and states
"; using the sum of an arithmetic series."
smh.... -
hitko31465yJudging by GPU and OpenCL tags, it's a formula to avoid GPU bank conflicts. Look it up, and for the love of whoever wrote that, don't touch it util you really understand what every single constant in that formula means, because someone spent a couple hours to make sure all threads can rad their ids within the same clock.
-
@hitko Yeah, was about to wade in to say a similar thing. I suspect whoever wrote that took more than a couple of hours to properly verify all those constants as well.
-
@hitko @AlmondSauce
Don't get me wrong. I know how it works and what it does, I was in the room when the data structure was agreed upon and did some of the maths to find the constants.
I'm mad because there is no fancy reason as to why the index is so unintuitive, we do it because the data on the CPU is structured in an object-oriented way and it is faster to build the array(s) in this way than one that makes the indices nicer.
It would be beneficial to readability and performance(reducing cache misses greatly) if we would structure the data on the CPU differently, but NO we rather do this as a quick fix.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
You know your codebase is fucked beyond restoration when a one-dimensional array is indexed using two indices and this formula.
FUCK.
rant
c++
opencl
gpu
refactor needed
does any one read these?