In the past several weeks I have been porting a codebase from Nvidia CUDA platform to AMD HIP. Several critical issues were encountered, some solved, some attributed to compiler bugs, some remaining unfathomable to me.
There are 3 important things I have learned so far from the painstaking debugging process.
- An unsigned integer with n bits only allows 0~(n-1) times bitwise left shift (
<<). Excess shifts lead to undefined behavior. For Nvidia platform, 0 bit will be added, whereas for AMD, 1 bit will be added!!!
- Currently there is a serious compiler bug: the wavefront vote function
__any(pred) , which is supposed to work like
__any_sync(__activemask(), pred) in CUDA, yields incorrect result in divergent threads!!!
- This is very easy to miss: the parameter of wavefront vote functions
__all(pred), etc is a 32-bit integer for both Nvidia and AMD platforms. If, however, a 64-bit integer is passed to the function, higher bits will be truncated!!! The solution is to explicitly cast the 64-bit integer to bool, which is then implicitly cast to int.
When I started to develop my first CUDA application, sm_21 was the then most advanced architecture. Now they are gone, completely deprecated. Tempus fugit.
- You are not illiterate.
- Confucius say it is easy to hate and difficult to love. Frankie say relax.
- Thank you Lo Wang! But your fortune is in another cookie!
- What’s a seven-letter word for ‘cryptic’?
- Live each day like it’s your last. Or at least today, because… Oh I don’t want to spoil it.
- Light travels faster than sound. That’s why some people look brilliant, until you hear them speak.
- Whoever coined the phrase ‘quiet as a mouse’ never stepped on one.
- Help! I am being held prisoner in a video game factory.
- Don’t sweat the petty things and don’t pet the sweaty things. – George Carlin
- You’re never too old to learn something stupid.
- All men eat, but Fu Man Chu.
- Some mistakes are too fun to make only once.
- With sufficient thrust, pigs fly just fine.
- He who takes advice from a cookie is sure to crumble.
- You will stop procrastinating. Later.
- Cardboard belt is a waist of paper.
- The difference between an oral thermometer and a rectal thermometer is all a matter of taste.
- You don’t need a parachute to skydive. You need a parachute to skydive twice.
- Laugh and the world laughs with you. Cry and the world laughs at you.
- That’s what ki said.
- The good news: you’re not paranoid. The bad news: everyone is actually trying to kill you.
- The early bird gets the worm. The second mouse gets cheese.
- Small cookies bring great joy.
- Time is an illusion. Lunchtime doubly so.
- To be is to do. – Socrates
To do is to be. – Sarte
Do be do be do. – Sinatra
- It is better to have loved and lost than to have had loved and gotten syphilis.
- Cookie monster wasn’t here.
- Chew, or chew not. There is no pie.
- To maintain perfect accuracy, shoot first and call whatever you hit the target.
- Information is not knowledge. Knowledge is not wisdom. Wisdom is not truth. Truth is not beauty. Beauty is not love. Love is not music. Music is the best. – FZ
- Man who stand on toilet, high on pot.
- It is better to have loved and lost than to have loved and got syphilis.
Reference: Shadow Warrior (2013)
Nvidia: Hey, we have now started supporting icc 17.0 since cuda 9.0, but we won’t tell you that this is what you would end up having for your c++11 code:
nvcc warning : The -std=c++11 flag is not supported with the configured host compiler. Flag will be ignored.
Intel: Hey, just want to let you know that we have removed support for Knights Corner accelerators since icc 18. Now you either keep using older icc, or buy a brand new server with our brand new Knights Landing CPU.
And AMD: Sorry that Vega is a let-down, but hey, ours are cheaper!
Day 1 is pretty disappointing. rapha lost to cooller without landing a single round; Team Liquid was stomped by 2z; Quakecon venue lost internet connection.
Day 2 is full of amazing matches. rapha managed to win two matches in group stage, and then survived Raisy scare. However, in the quarter final, he lost to his self-effacing teammate dahang. I root for rapha, and hope he will come back stronger next year. cooller continued his invincible state, until surprisingly thwarted by the young talent clawz in the semi final.
Final day, clawz is remembered forever in quake history as the first player to win the championship of both duel and sacrifice. Everybody was awed, mouth agape. Also being remembered is clawz’s extreme bad manner towards Vo0 and the way he talked in his interview. Guess the kid has a lot to learn.
How many times have we seen AAA games with upgraded graphics today turn out a pile of hyped garbage, a horrendous ripoff? To name a few of this year:
- No man’s sky (perhaps the worst game, the most notorious scam of all time in human history)
- Quantum break
- The Deus Ex: Mankind Divided
- Street Fighter V
- Far Cry Primal
Behind these worthless craps are game studios who are only here to siphon off hard-earned money from us gamers ruthlessly and rabidly, and do not give a single damn about their games.
Fortunately, Polish game studios are an exception, an opposite. They care about us. Their games give me strength and warmth, and touch my soul.
- Witcher by CD Projekt Red (Witcher 3: Wild Hunt is doubtless the best RPG game, a legendary masterpiece)
- Shadow warrior by Flying Wild Hog
To toast Polish developers and designers, who restore my faith in humanity.