{"id":388,"date":"2022-09-11T10:16:18","date_gmt":"2022-09-11T10:16:18","guid":{"rendered":"https:\/\/blogs.gentoo.org\/gsoc\/?p=388"},"modified":"2022-09-11T10:16:18","modified_gmt":"2022-09-11T10:16:18","slug":"week-12-report-for-refining-rocm-packages-in-gentoo","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/gsoc\/2022\/09\/11\/week-12-report-for-refining-rocm-packages-in-gentoo\/","title":{"rendered":"Week 12 Report for Refining ROCm Packages in Gentoo"},"content":{"rendered":"<p>Although this is the final week, I would like to say that it is as exciting as the first week.<\/p>\n<p>I kept polishing <code>rocm.eclass<\/code> with the help of Micha\u0142 and my mentor, and it is now in good shape [1]. I must admit that the time to write an eclass for a beginner like me is much more than what I expected. In my proposal, I leave 4 weeks to finish it, 2-week implementation and 2-week polishing. In reality, I implemented within 2 weeks, but polished it for 4 weeks. I made a lot of QA issues and was not aware, which increases the number of review-modify cycles. During this process, I leant a lot:<\/p>\n<p>1. Always re-read the eclass, especially comments and examples thoroughly after modification. Many times I forgot there is an example far from the change that should be updated because one functions changes its behavior.<\/p>\n<p>2. Read the bash manual carefully, because properly usage of features like bash array can greatly simplify code.<\/p>\n<p>3. Consider the maintenance difficulty of the eclass. I wrote a oddly specific `src_test`, which can cover all the cases of ROCm packages. But it&#8217;s not worth it, because specialized code should be placed into ebuilds, not one eclass. So instead, I remain the most common part, `check_amdgpu`, and get rid of phase functions, which made the eclass much cleaner.<\/p>\n<p>I also find some bugs and their solutions. As I mentioned in week 10&#8217;s report, I observed many test failures in <code>sci-libs\/miopen<\/code> based on vanilla clang. In this week, I figured out that they have 3 different reasons, and I&#8217;ve provided the two fixes for two failures ([2, 3]). The third issue, I&#8217;ve found it&#8217;s root cause [4]. I believe there would be a simple solution to this.<\/p>\n<p>For gcc-12 issues, I also come to a brutal workaround [5]: undef the <code>__noinline__<\/code> macro before including stdc++ headers and def it afterwards. I also observed that clang-15 does not fix this issue as expected, and provided a MWE at [6].<\/p>\n<p>I&#8217;m also writing wiki pages, filling installation and developing guide.<\/p>\n<p>In this 12-week project, I proposed to deliver <code>rocm.eclass<\/code>, and packages like pytorch, tensorflow with rocm enabled. Instead, I delivered <code>rocm.eclass<\/code> as proposed, but migrated the ROCm toolchain to vanilla clang. I thought porting ROCm toolchain to vanilla clang is closer to my project title &#8220;Refining ROCm Packages&#8221; \ud83d\ude42<\/p>\n<p>[1] https:\/\/github.com\/gentoo\/gentoo\/pull\/26784<br \/>\n[2] https:\/\/github.com\/littlewu2508\/gentoo\/commit\/2bfae2e26a23d78b634a87ef4a0b3f0cc242dbc4<br \/>\n[3] https:\/\/github.com\/littlewu2508\/gentoo\/commit\/cd11b542aec825338ec396bce5c63bbced534e27<br \/>\n[4] https:\/\/github.com\/ROCmSoftwarePlatform\/MIOpen\/issues\/1731<br \/>\n[5] https:\/\/github.com\/littlewu2508\/gentoo\/commit\/2a49b4db336b075f2ac1fdfbc907f828105ea7e1<br \/>\n[6] https:\/\/github.com\/llvm\/llvm-project\/issues\/57544<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although this is the final week, I would like to say that it is as exciting as the first week. I kept polishing rocm.eclass with the help of Micha\u0142 and my mentor, and it is now in good shape [1]. &hellip; <a href=\"https:\/\/blogs.gentoo.org\/gsoc\/2022\/09\/11\/week-12-report-for-refining-rocm-packages-in-gentoo\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":179,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/388"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/users\/179"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/comments?post=388"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/388\/revisions"}],"predecessor-version":[{"id":389,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/posts\/388\/revisions\/389"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/media?parent=388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/categories?post=388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/gsoc\/wp-json\/wp\/v2\/tags?post=388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}