Kunal S. Pathak's blogs A virtual proof that I'm awesome https://kunalspathak.github.io/ Antigen A fuzzer to test .NET's RyuJIT - What is it? Antigen is a fuzzer that generates random C# programs on the fly to test .NET’s RyuJIT. How does it work? Antigen generates random C# programs and execute them in baseline and test mode. In baseline mode there is minimal optimizations enabled, while in test mode, it executes... Thu, 30 Sep 2021 00:00:00 -0700 https://kunalspathak.github.io/2021-09-30-Antigen/ https://kunalspathak.github.io/2021-09-30-Antigen/ Genetic algorithm for Register Allocation Experiment that gave great insights - This post is also part of .NET’s design docs: lsra-heuristic-tuning. Background RyuJIT’s implements linear scan register allocation (LSRA) algorithm to perform the register assignment of generated code. During register selection, LSRA has various heuristics (17 to be precise) to pick the best register candidate at a given point. Each register... Thu, 22 Jul 2021 00:00:00 -0700 https://kunalspathak.github.io/2021-07-22-Genetic-Algorithms-In-LSRA/ https://kunalspathak.github.io/2021-07-22-Genetic-Algorithms-In-LSRA/ Arm64 Hardware Intrinsics APIs in .NET - Part 7 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sun, 11 Apr 2021 00:00:00 -0700 https://kunalspathak.github.io/2021-04-11-.NET-Hardware-Intrinsics-Part7/ https://kunalspathak.github.io/2021-04-11-.NET-Hardware-Intrinsics-Part7/ Loop alignment in .NET Performance and stability improvement - Contents Introduction Code alignment Heuristics Alignment boundary Loop selection Loop size Aligned loop Padding amount Padding placement Memory cost Impact Edge cases Future work Loop alignment in other compilers GCC LLVM Chakra (Javascript engine) Conclusion References Introduction When writing a software, developers try their best to maximize the performance they... Mon, 15 Mar 2021 00:00:00 -0700 https://kunalspathak.github.io/2021-03-15-Loop-Alignment/ https://kunalspathak.github.io/2021-03-15-Loop-Alignment/ Arm64 Hardware Intrinsics APIs in .NET - Part 6 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sun, 17 Jan 2021 00:00:00 -0800 https://kunalspathak.github.io/2021-01-17-.NET-Hardware-Intrinsics-Part6/ https://kunalspathak.github.io/2021-01-17-.NET-Hardware-Intrinsics-Part6/ Being positive in 2020 A long and unforgettable year - “Being positive” proved to be the most negative phrase of 2020 or on the other hand, if you have ever heard someone saying “he/she is negative”, that was the most desirable thing you wanted to hear in this pandemic year. The year 2020, being one of the worst years in... Thu, 31 Dec 2020 00:00:00 -0800 https://kunalspathak.github.io/2020-12-31-Being-positive/ https://kunalspathak.github.io/2020-12-31-Being-positive/ Arm64 Hardware Intrinsics APIs in .NET - Part 5 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sat, 05 Dec 2020 00:00:00 -0800 https://kunalspathak.github.io/2020-12-05-.NET-Hardware-Intrinsics-Part5/ https://kunalspathak.github.io/2020-12-05-.NET-Hardware-Intrinsics-Part5/ Doskey in Windows A hidden MS-DOS "alias" utility - Introduction Ever since I came to know about the doskey command in MS-DOS, I could barely stop myself using it. Not many Windows developers are familiar with this command, but this is a very powerful command to have in the arsenal of any Windows developer who frequently works on command... Sat, 21 Nov 2020 00:00:00 -0800 https://kunalspathak.github.io/2020-11-21-About-doskeys/ https://kunalspathak.github.io/2020-11-21-About-doskeys/ Arm64 Hardware Intrinsics APIs in .NET - Part 4 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sat, 31 Oct 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-10-31-.NET-Hardware-Intrinsics-Part4/ https://kunalspathak.github.io/2020-10-31-.NET-Hardware-Intrinsics-Part4/ Non-fictional books My favorite library collection - To make a good career, we start diving into lot of technical books since our early 20s. Some books we read over and over because either we fail to understand their content first few times or the concept itself is so intriguing that you want to refresh your memories with... Sat, 17 Oct 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-10-17-Favorite-books/ https://kunalspathak.github.io/2020-10-17-Favorite-books/ Arm64 Hardware Intrinsics APIs in .NET - Part 3 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sat, 03 Oct 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-10-03-.NET-Hardware-Intrinsics-Part3/ https://kunalspathak.github.io/2020-10-03-.NET-Hardware-Intrinsics-Part3/ Arm64 Hardware Intrinsics APIs in .NET - Part 2 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sat, 26 Sep 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-09-26-.NET-Hardware-Intrinsics-Part2/ https://kunalspathak.github.io/2020-09-26-.NET-Hardware-Intrinsics-Part2/ Arm64 Hardware Intrinsics APIs in .NET - Part 1 Sample code usage, examples and generated assembly code - Introduction In my vectorization using .NET APIs blog, I describe SIMD datatypes Vector64<T> and Vector128<T> that operates on ‘Arm64 hardware intrinsic’ APIs present under System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class. In this post I will describe those hardware intrinsic APIs by showing sample code usage along with examples and generated Arm64 code.... Sat, 19 Sep 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-09-19-.NET-Hardware-Intrinsics-Part1/ https://kunalspathak.github.io/2020-09-19-.NET-Hardware-Intrinsics-Part1/ Programmatic blog generation 700 lines of code to produce 20,000 lines of blog - Motivation Currently, the Microsoft docs for methods in System.Runtime.Intrinsics.Arm.AdvSimd and System.Runtime.Intrinsics.Arm.AdvSimd.Arm64 class doesn’t have much description and just have the ARM instruction name that it uses. A .NET developer who is not familiar with these APIs will first check the ARM instruction for the .NET API and then search for... Sat, 12 Sep 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-09-12-Automating-Blog-Generation/ https://kunalspathak.github.io/2020-09-12-Automating-Blog-Generation/ ARM64 code size Why it is larger than x64? - This is the 5th blog posts of ARM64 performance series that talks about performance investigation I did for .NET 5. You can read previous blogs at: Part 1 - ARM64 performance of .Net Core Part 2 - Memory barriers in ARM64 Part 3 - Peephole optimizations in ARM64 Part 4... Sun, 23 Aug 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-08-23-ARM64-code-size/ https://kunalspathak.github.io/2020-08-23-ARM64-code-size/ Two mystic ARM64 instructions Getting biggest code size improvement in .NET 5 - This is the 4th of the blog posts series that talks about ARM64 performance investigation for .NET core. You can read previous blogs at: Part 1 - ARM64 performance of .Net Core Part 2 - Memory barriers in ARM64 Part 3 - Peephole optimizations in ARM64 In this post, I... Sat, 15 Aug 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-08-15-Two-mystic-ARM64-instructions/ https://kunalspathak.github.io/2020-08-15-Two-mystic-ARM64-instructions/ Peephole optimizations in .NET Possibilities to improve ARM64 code - This is the 3rd of the blog posts series that talks about ARM64 performance investigation for .NET 5. You can read previous blogs at: Part 1 - ARM64 performance of .Net Core Part 2 - Memory barriers in ARM64 In this post, I will describe an important compiler phase “peephole... Sat, 08 Aug 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-08-08-ARM64-peephole-optimizations/ https://kunalspathak.github.io/2020-08-08-ARM64-peephole-optimizations/ Vectorization using .NET APIs Vector64<T>, Vector128<T> and Vector256<T> - Introduction It has been few years now that .NET have added SIMD support. Last year, in .NET Core 3.0, a new feature “hardware intrinsics” was introduced. This feature gives access to various vectorized and non-vectorized hardware instructions that modern hardware support. .NET developers can access these instructions using set of... Sat, 01 Aug 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-08-01-Vectorization-APIs/ https://kunalspathak.github.io/2020-08-01-Vectorization-APIs/ Memory barriers in ARM64 The cost of weakly-ordered memory model - This is the 2nd of the blog posts series that talks about ARM64 performance investigation for .NET 5. You can read my previous blog at Part 1 - ARM64 performance of .Net Core. In this post, I will describe the implication of weakly-ordered memory model of ARM64 on generated code... Sat, 25 Jul 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-07-25-ARM64-Memory-Barriers/ https://kunalspathak.github.io/2020-07-25-ARM64-Memory-Barriers/ Teaching biking lessons to my 5 years old Joy I will never forget - Last Saturday I took my daughter to a drive-thru birthday party. This is a typical birthday party organized now a days in covid-19 world. Parents drive their kids to the birthday person’s home so kids can give birthday wishes and spend some time playing outside while trying to maintain social... Sat, 18 Jul 2020 00:00:00 -0700 https://kunalspathak.github.io/2020-07-18-Teaching-biking-lessons/ https://kunalspathak.github.io/2020-07-18-Teaching-biking-lessons/