<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yukti Manoj Mulani</title>
    <description>The latest articles on DEV Community by Yukti Manoj Mulani (@yuktimulani).</description>
    <link>https://dev.to/yuktimulani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1473227%2F62020ba1-10ce-483a-8563-6d127f9339fb.jpeg</url>
      <title>DEV Community: Yukti Manoj Mulani</title>
      <link>https://dev.to/yuktimulani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yuktimulani"/>
    <language>en</language>
    <item>
      <title>Project Stage-3: Reflections and Final Thoughts on Implementing AFMV in GCC</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 21 Jun 2024 23:50:08 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-3-reflections-and-final-thoughts-on-implementing-afmv-in-gcc-45gp</link>
      <guid>https://dev.to/yuktimulani/project-stage-3-reflections-and-final-thoughts-on-implementing-afmv-in-gcc-45gp</guid>
      <description>&lt;p&gt;As the summer project for SPO600 comes to a close, it’s time to reflect on the journey of implementing Automatic Function Multi-Versioning (AFMV) for AArch64 systems in GCC. This final blog post summarizes the accomplishments, challenges, and learnings from this project, and provides insights into the future work that could enhance this feature further.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Overview and Contributions&lt;/strong&gt;&lt;br&gt;
Over the course of this project, my primary focus was on extending GCC to support AFMV, particularly with features like SVE2 for AArch64 processors. AFMV aims to provide performance optimizations by automatically creating function clones optimized for different processor features, enabling the software to dynamically choose the most efficient version at runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Contributions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enhanced the GCC’s &lt;code&gt;multiple_target.cc&lt;/code&gt; file to recognize and handle SVE2 attributes effectively.&lt;/li&gt;
&lt;li&gt;Integrated advanced GCC flags to support the SVE2 instruction set.&lt;/li&gt;
&lt;li&gt;Addressed and resolved critical errors related to attribute recognition in GCC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code Location and Integration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository Branch: The changes were committed to the 2&lt;code&gt;024-S-FMV-automatic-function-cloning&lt;/code&gt; branch in the class Git repository.&lt;/li&gt;
&lt;li&gt;File Location: The specific changes were made in &lt;code&gt;gcc/gcc/multiple_target.cc&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Integration with Other Branches:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;2024-S-FMV-automatic-function-cloning&lt;/code&gt; branch was regularly rebased with the main development branch to ensure compatibility and to integrate the latest updates from other team members working on related tasks.&lt;/li&gt;
&lt;li&gt;Collaboration with other contributors was key to integrating AFMV with various diagnostic and function pruning tools being developed concurrently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What Works and Achievements&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Successful SVE2 Integration: By using advanced GCC flags, I was able to enable SVE2 support, which allows for greater optimization potential in function cloning and selection.&lt;/li&gt;
&lt;li&gt;Improved Attribute Handling: The modifications made to &lt;code&gt;multiple_target.cc&lt;/code&gt; ensure that attributes like target("sve2") are now valid and properly handled by the compiler.&lt;/li&gt;
&lt;li&gt;Enhanced Performance Diagnostics: The project also contributed to improved diagnostic outputs that help developers understand the effects of function multi-versioning and optimize their code more effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations and What Needs Improvement:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limited Testing Scope: Although the project saw significant progress, the testing was limited to specific cases and hardware. More extensive testing across diverse AArch64 systems is needed.&lt;/li&gt;
&lt;li&gt;Error Handling and Debugging: While some critical errors were resolved, the handling of complex attribute combinations still requires refinement. Future work should focus on improving the robustness of error handling.&lt;/li&gt;
&lt;li&gt;Documentation and Usability: Although I updated the documentation to some extent, it needs to be more comprehensive to assist new users and developers in understanding and utilizing the AFMV feature effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What Was Not Tested:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cross-Platform Performance: The testing primarily focused on AArch64, and the performance and functionality on other platforms like x86_64 need to be evaluated.&lt;/li&gt;
&lt;li&gt;Complex Use Cases: The project didn’t extensively cover complex real-world applications that could benefit from AFMV, such as those requiring intricate multi-core or SIMD optimizations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Reflections on the Project and Course&lt;/strong&gt;&lt;br&gt;
This project has been an incredible learning experience, providing deep insights into the workings of GCC and the intricacies of compiler design. Here are some key takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding Compiler Internals: The hands-on experience with GCC’s codebase was invaluable. It enhanced my understanding of how compilers manage attributes, perform optimizations, and generate machine-specific code.&lt;/li&gt;
&lt;li&gt;Challenges of Multi-Versioning: Implementing AFMV highlighted the complexities involved in function cloning and optimization, especially when dealing with diverse processor features and instruction sets.&lt;/li&gt;
&lt;li&gt;Collaborative Development: Working in a team environment and integrating code from multiple branches taught me the importance of version control, code reviews, and effective communication.&lt;/li&gt;
&lt;li&gt;Balancing Performance and Compatibility: The project underscored the delicate balance between optimizing for the latest hardware features and maintaining compatibility with older systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Next Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Moving forward, I plan to continue refining the AFMV implementation, focusing on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extending testing to cover more platforms and use cases.&lt;/li&gt;
&lt;li&gt;Improving documentation to facilitate broader adoption and usage.&lt;/li&gt;
&lt;li&gt;Collaborating with the GCC community to integrate these changes into the main GCC branch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project has been a rewarding journey, filled with both challenges and achievements. I am grateful for the opportunity to contribute to such an important tool in the open-source community and look forward to continuing this work in the future.&lt;/p&gt;

&lt;p&gt;For those interested, the code and changes are available in the &lt;code&gt;2024-S-FMV-automatic-function-cloning&lt;/code&gt; branch in the class Git repository. &lt;/p&gt;

&lt;p&gt;Until next time, happy coding 🚀!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage-3:Leveraging Advanced GCC Flags.</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 21 Jun 2024 23:18:33 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-3leveraging-advanced-gcc-flags-5e2l</link>
      <guid>https://dev.to/yuktimulani/project-stage-3leveraging-advanced-gcc-flags-5e2l</guid>
      <description>&lt;p&gt;Hello there!!&lt;/p&gt;

&lt;p&gt;As our journey towards implementing Automatic Function Multi-Versioning (AFMV) for AArch64 systems continues, I’ve encountered some intriguing challenges and solutions regarding the support of SVE2 (Scalable Vector Extension version 2) in GCC. This blog post explores how advanced GCC flags can be leveraged to overcome these hurdles, enabling a smoother path towards a fully functional AFMV setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Advanced GCC Flags:
&lt;/h2&gt;

&lt;p&gt;GCC (GNU Compiler Collection) is known for its robust support for various architectures and instruction sets, including SVE2. However, enabling these features sometimes requires explicit configuration through advanced flags. Here’s a breakdown of the steps I followed to integrate these features:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Identifying the Required Architecture Support:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The error indicated that SVE2 support wasn't automatically enabled, which led me to investigate the necessary architecture flags. SVE2 is part of the Armv8.5-A architecture, so I needed to ensure GCC was configured to support this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Adding the Appropriate Flags:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By consulting the GCC documentation and community forums, I identified the necessary flags to enable SVE2 support. The critical flags were -march and -mcpu, which dictate the target architecture and CPU:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc hello.c -o hello -O3 -march=armv8.5-a+sve2 -mcpu=cortex-a75
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s a brief explanation of the flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-march=armv8.5-a+sve2&lt;/code&gt;: Specifies the target architecture, including SVE2.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-mcpu=cortex-a75&lt;/code&gt;: Specifies the CPU, ensuring that it aligns with the required architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Integrating the Flags into the Build Process:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By incorporating these flags into my build commands, I ensured that the compiler was correctly configured to recognize and support the SVE2 instructions. This involved updating my Makefile and build scripts to include these flags.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Validating the Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After adding the flags, I recompiled my code and verified that the target("sve2") attribute was now recognized and valid. Here’s a snippet of the updated hello.c:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

__attribute__((target("sve2")))
void my_function() {
    printf("This function utilizes SVE2 instructions.\n");
}

int main() {
    my_function();
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Insights and Learnings:
&lt;/h2&gt;

&lt;p&gt;This experience underscored the importance of understanding and leveraging advanced GCC flags to achieve the desired functionality. It was a reminder that while GCC is incredibly powerful, it often requires explicit configuration to support specialized features like SVE2.&lt;/p&gt;

&lt;p&gt;In summary, the addition of advanced GCC flags was crucial in enabling SVE2 support, thereby allowing us to move forward with the AFMV implementation. This journey has been instrumental in deepening my understanding of compiler configurations and their impact on project outcomes.&lt;/p&gt;

&lt;p&gt;Stay tuned for the next post in this series, where I’ll delve into the performance optimizations made possible through AFMV and SVE2!&lt;/p&gt;

&lt;p&gt;Until next time, happy coding 🚀!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage-3: Overcoming Compiler Attribute Challenges</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 21 Jun 2024 23:05:11 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-3-overcoming-compiler-attribute-challenges-3le3</link>
      <guid>https://dev.to/yuktimulani/project-stage-3-overcoming-compiler-attribute-challenges-3le3</guid>
      <description>&lt;p&gt;Welcome back folks!! In our quest to implement Automatic Function Multi-Versioning (AFMV) for AArch64, one of the critical challenges has been dealing with compiler attribute errors. The target("sve2") attribute error was a particular stumbling block. Here’s how I tackled it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Error Message:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: pragma or attribute ‘target("sve2")’ is not valid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Steps to Resolve:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. GCC Version and Compatibility Check:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Verified that my GCC version supports SVE2 with gcc --version.&lt;br&gt;
Updated GCC to the latest version to ensure full support for the attribute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Correct Usage of Attributes:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Adjusted the context in which the target attribute was applied, ensuring it was used correctly in the function definition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Compilation Flags:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Added -march=armv8.5-a+sve2 to the GCC command to explicitly enable SVE2 support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Code Adjustment:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

__attribute__((target("sve2")))
void my_function() {
    printf("This function uses SVE2 instructions.\n");
}

int main() {
    my_function();
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With these adjustments, the attribute error was resolved, allowing me to continue with the AFMV implementation. This process underscored the importance of aligning compiler settings with the specific architectural requirements.&lt;/p&gt;

&lt;p&gt;Until next time , happy coding 🚀!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage-3: Digging Deeper</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 21 Jun 2024 22:43:26 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-3-digging-deeper-mcg</link>
      <guid>https://dev.to/yuktimulani/project-stage-3-digging-deeper-mcg</guid>
      <description>&lt;p&gt;Hi Peeps!! Welcome back. Without wasting any time lets continue from the  &lt;a href="https://dev.to/yuktimulani/project-stage-3-error-analysis-3lm4"&gt;last blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The error message related to the target("sve2") attribute has been a key focus in the latest phase of our AFMV implementation. The message was clear but presented a challenge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: pragma or attribute ‘target("sve2")’ is not valid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To address this, I first ensured that my GCC version supports SVE2 instructions. Using the command gcc --version, I verified the version and compatibility. Here’s what I found:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GCC Version Check: Confirmed that my GCC version was up-to-date and should theoretically support SVE2.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, I explored the usage and context of the target attribute. Here’s a snippet from my hello.c file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

__attribute__((target_clones("sve2")))
void my_function() {
    printf("This function uses SVE2 instructions.\n");
}

int main() {
    my_function();
    return 0;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite the correct syntax, the error persisted. This led me to check if there were specific flags required to enable SVE2 support. The solution involved adding -march=armv8.5-a+sve2 to the GCC compilation command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc hello.c -o hello -O3 -march=armv8.5-a+sve2

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This resolved the issue, confirming that the attribute was now valid under the specified architecture. The journey continues, but this was a significant step towards a functioning AFMV implementation.&lt;/p&gt;

&lt;p&gt;Until next time, happy coding 🚀!!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage-3: Error Analysis</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 21 Jun 2024 22:29:50 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-3-error-analysis-3lm4</link>
      <guid>https://dev.to/yuktimulani/project-stage-3-error-analysis-3lm4</guid>
      <description>&lt;p&gt;Hi folks!!! Welcome to my series of Summer Project blogs. As part of the SPO600 2024 Summer Project, my objective in Stage 3 is to resolve Automatic Function Multi-Versioning (AFMV) error messages within the GNU Compiler Collection (GCC). AFMV is a cutting-edge feature designed to optimize function calls across different micro-architectural levels, making software more adaptable and efficient on various hardware platforms.&lt;/p&gt;

&lt;p&gt;The goal of this stage is to ensure that the AFMV implementation in GCC functions seamlessly by identifying, analyzing, and resolving error messages that arise during its use. This post will introduce the scope of Stage 3, highlight the challenges of dealing with AFMV error messages, and outline the approach for resolving these issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Messages Context:
&lt;/h2&gt;

&lt;p&gt;Automatic Function Multi-Versioning (AFMV) allows for the creation of multiple versions of a function, optimized for different hardware features, without requiring changes to the source code. This capability significantly enhances software performance by leveraging the latest hardware optimizations automatically.&lt;/p&gt;

&lt;p&gt;However, implementing AFMV comes with its own set of challenges. One major issue is the occurrence of error messages that can be cryptic and difficult to understand, making it challenging to troubleshoot and fix problems. These errors can arise from various sources, such as syntax issues, misconfigurations, or conflicts with other compiler features.&lt;br&gt;
The error message that is troubling us is like so-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscq2o9sdw2vpw4lonch0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscq2o9sdw2vpw4lonch0.png" alt="Image description" width="781" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Initial Challenges:
&lt;/h2&gt;

&lt;p&gt;The main challenge in this stage is the complexity of the AFMV feature and the intricacies of the GCC codebase. Error messages in GCC can be quite specific and may involve multiple components of the compiler. Understanding the context in which these errors occur is crucial for effective resolution.&lt;/p&gt;

&lt;p&gt;Additionally, some error messages may not directly point to the root cause of the issue, requiring a thorough investigation and sometimes even modifying the compiler's internal mechanisms to achieve a fix. This stage is not just about fixing bugs but also understanding how AFMV integrates into the broader GCC architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals for Stage 3:
&lt;/h2&gt;

&lt;p&gt;The primary goals for this stage are:&lt;/p&gt;

&lt;p&gt;Identify Error Messages: Categorize and document the various AFMV-related error messages encountered during compilation.&lt;/p&gt;

&lt;p&gt;Analyze Root Causes: Perform a deep dive into the causes of these errors, identifying any common patterns or recurring issues.&lt;/p&gt;

&lt;p&gt;Resolve Issues: Implement fixes for these errors, ensuring that AFMV functions correctly and efficiently within GCC.&lt;/p&gt;

&lt;p&gt;Document Solutions: Provide detailed documentation of the errors and their resolutions to aid future development and troubleshooting efforts.&lt;/p&gt;

&lt;p&gt;Integrate and Test: Ensure that the solutions are integrated into the main codebase and thoroughly tested for robustness.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;p&gt;In the following blog posts, I will delve deeper into the specifics of AFMV errors, the strategies used to resolve them, and the testing processes involved. This journey is not just about solving problems but also about enhancing our understanding of GCC and contributing to a more efficient and flexible compiler.&lt;/p&gt;

&lt;p&gt;Stay tuned as we explore the fascinating world of AFMV and GCC error handling in more detail.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Project Stage-2 Implementation Part-3</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Tue, 18 Jun 2024 21:00:41 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-2-implementation-part-3-2fhk</link>
      <guid>https://dev.to/yuktimulani/project-stage-2-implementation-part-3-2fhk</guid>
      <description>&lt;p&gt;Welcome back, everyone! In the previous part of this series, we delved into the complexities of Function Multi-Versioning (FMV) and started exploring the depths of GCC's inner workings. After painstakingly investigating files like &lt;code&gt;tree.h, tree.cc, and tree-inline.h&lt;/code&gt;, we honed in on the elusive function responsible for FMV: &lt;code&gt;expand_target_clones in multiple_target.cc&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unpacking the Errors: Invalid Target Attributes
&lt;/h2&gt;

&lt;p&gt;As I ventured deeper into the code, modifying the expand_target_clones function to automatically create function clones for various target architectures, I encountered a persistent error that quickly turned my excitement into frustration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: pragma or attribute ‘target("sve-bf16")’ is not valid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite my best efforts to resolve this error, it remained stubbornly present. This error indicates that the specified target attribute isn't recognized or supported by my current GCC setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diagnosing the Error: Why It Happened
&lt;/h2&gt;

&lt;p&gt;This error message typically arises when:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Unsupported Target Architecture: The specified target attribute is not supported by the GCC version being used.&lt;/li&gt;
&lt;li&gt;Incorrect Attribute Syntax: The attribute might be formatted or spelled incorrectly, causing GCC to reject it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Steps Taken to Resolve the Error
&lt;/h2&gt;

&lt;p&gt;To tackle this issue, I followed a structured approach to diagnose and attempt to resolve the problem&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Verify Supported Target Attributes
&lt;/h3&gt;

&lt;p&gt;First, I needed to determine which target architectures were actually supported by my GCC version (11.3.1). I used the command below, which is intended to list all valid target architectures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc -E -march=help -xe /dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, this command resulted in an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc: error: unrecognized command line option ‘-march=help’
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite the error, it hinted at valid target architectures. Knowing that my GCC version was 11.3.1, I needed to cross-reference the valid targets for this version.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Cross-Check GCC Documentation
&lt;/h3&gt;

&lt;p&gt;I reviewed the official GCC documentation for version 11.3.1, which provides comprehensive information on supported target architectures. This step was crucial in understanding which attributes were valid for the version I was using.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Update Hardcoded Attributes
&lt;/h3&gt;

&lt;p&gt;With the correct list of supported targets, I revised my hardcoded attributes to include only those that were valid. Instead of &lt;code&gt;sve-bf16&lt;/code&gt;, I opted for more widely supported attributes like sve and sve2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const int num_attrs = 2;
char attrs2[num_attrs][5] = {"sve", "sve2"};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite this change, the error persisted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Investigations and Continued Errors
&lt;/h2&gt;

&lt;p&gt;Even after updating the attributes, the error did not disappear. This was a significant setback, but it also provided an opportunity to deepen my understanding of the issue.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Examine CPU Features
&lt;/h3&gt;

&lt;p&gt;I examined the /proc/cpuinfo file to understand the supported features of my CPU. This information helped confirm that the hardware supported the attributes I was attempting to use.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /proc/cpuinfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, this did not shed light on why the compiler continued to reject the target attributes.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Investigate GCC Configuration
&lt;/h3&gt;

&lt;p&gt;I reviewed the GCC configuration to ensure that it was built with support for the architectures I was targeting. Ensuring that the compiler itself was correctly configured was essential, but it did not resolve the error.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Seek Insights from Community Resources
&lt;/h3&gt;

&lt;p&gt;I turned to forums and mailing lists where other developers had discussed similar issues. While there were many insights, none directly addressed the persistent error I was encountering.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways and Next Steps
&lt;/h2&gt;

&lt;p&gt;This part of the project was filled with challenges, highlighting the complexities of compiler development. Here are the key takeaways from this experience:&lt;/p&gt;

&lt;p&gt;Persistent Errors Are Learning Opportunities: While frustrating, persistent errors offer a chance to deepen your understanding and refine your approach.&lt;br&gt;
Documentation and Community Insights Are Valuable: Reviewing documentation and seeking community insights can provide guidance, even if they don't always offer immediate solutions.&lt;br&gt;
Next Steps: A Plan for Resolving the Error&lt;br&gt;
Given the persistent error, here are the steps I plan to take next:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Verify GCC Build and Configuration
&lt;/h3&gt;

&lt;p&gt;I will verify that my GCC build includes the necessary support for the target attributes. This involves checking the configuration and potentially rebuilding GCC with the required features.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Test with Different GCC Versions
&lt;/h3&gt;

&lt;p&gt;Testing with different GCC versions may help identify if the issue is specific to version 11.3.1. This could provide insights into whether a version upgrade or a different build is necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Explore Alternative Architectures
&lt;/h3&gt;

&lt;p&gt;I will explore using alternative target architectures that are widely supported and verified to work with my setup. This may involve testing with simpler or more generic attributes initially.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Debug with Detailed Logging
&lt;/h3&gt;

&lt;p&gt;I will enable detailed logging and diagnostics in GCC to better understand why the error occurs. This may involve using flags or modifying the GCC code to provide more information during compilation.&lt;/p&gt;

&lt;p&gt;Wrapping It Up: Lessons Learned and Moving Forward&lt;br&gt;
Despite the persistent error, this project has been a valuable learning experience. It has highlighted the importance of persistence, attention to detail, and the value of community and documentation in tackling complex issues.&lt;/p&gt;

&lt;p&gt;As I continue to work through these challenges, I am optimistic that the next steps will provide the insights needed to resolve the error and successfully implement the automatic FMV cloning feature.&lt;/p&gt;

&lt;p&gt;Thank you for joining me on this journey. Stay tuned for more updates as I continue to unravel the mysteries of GCC and FMV. Happy coding! 🚀&lt;/p&gt;

</description>
      <category>gcc</category>
    </item>
    <item>
      <title>Project Stage-2 Implementation [part-2]</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 14 Jun 2024 22:53:24 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-2-implementation-part-2-klo</link>
      <guid>https://dev.to/yuktimulani/project-stage-2-implementation-part-2-klo</guid>
      <description>&lt;p&gt;Welcome back peeps!! After a lot of theory about function multi versioning in the &lt;a href="https://dev.to/yuktimulani/project-stage-2-implementation-part-1-1p4n"&gt;last blog&lt;/a&gt; we will start actually working on it in this part. So, without wasting any time lets get started.&lt;/p&gt;

&lt;p&gt;I started with exploring files like &lt;br&gt;
&lt;code&gt;tree.h&lt;/code&gt;,&lt;code&gt;tree.cc&lt;/code&gt;and &lt;code&gt;tree-inline.h&lt;/code&gt; &lt;br&gt;
to understand how functions are represented and cloned in GCC's gimble IR. Now the question is how do I find them. So I used the following commands and experimented with the arguments here and there and came up with the following.&lt;br&gt;
Syntax&lt;br&gt;
&lt;code&gt;find /path -iname filename&lt;/code&gt;&lt;br&gt;
This was the actual command I used&lt;br&gt;
&lt;code&gt;find ./ -iname tree.h&lt;/code&gt;&lt;br&gt;
The file &lt;code&gt;tree.h&lt;/code&gt;is in gcc/gcc/tree.h To view thw contents of the file we can use the command &lt;code&gt;cat tree.h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After taking time to investigate the file I found out that the file contains code to help around function multiversioning and deaclares those functions but does not contain the code that is used to create clones.&lt;br&gt;
Now lets explore other files.This time lets use the vim editor to read the file which make it a little easy ti read.The commanf for that is :-&lt;br&gt;
&lt;code&gt;vi tree.cc&lt;/code&gt;&lt;br&gt;
This file is also lacated in the /gcc/gcc/ directory.&lt;br&gt;
This file does not look very useful because it contains code for the tree structure and not multi versioning. &lt;/p&gt;

&lt;p&gt;Now explore the third file &lt;code&gt;tree-inline.h&lt;/code&gt;. Using the same command for vim editor. To exit vim editor without saving anything, use the command.&lt;code&gt;:Q!&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;This file contains code related to inlining, versioning, cloning, and parallelization. The presence of these keywords made me feel that I am close to the actual code where turning AFMV on and passing the target architectures array is located. &lt;/p&gt;

&lt;p&gt;If you want to search for a keyword in vim editor, just type.&lt;br&gt;
&lt;code&gt;/word&lt;/code&gt; &lt;br&gt;
I searched for the word version by using &lt;code&gt;/version&lt;/code&gt; and found the declaration of the function called &lt;br&gt;
&lt;code&gt;bool tree_versionable_function_p(tree);&lt;/code&gt;&lt;br&gt;
This function was declared under the comment &lt;br&gt;
&lt;code&gt;"/*function prototypes*/"&lt;/code&gt;. &lt;br&gt;
By the declaration and the name, it seems that this function determines whether the code is versionable or not. A few more commands that I tried to find the actual code were following. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;grep "clon" -r&lt;/code&gt;&lt;br&gt;
This commands grabs all the files containing the word "clon". It gace an ecdless list of files making it impossible to indentify&lt;/p&gt;

&lt;p&gt;&lt;code&gt;grep "fmv" -r&lt;/code&gt;&lt;br&gt;
this gave me a shorter list but no results.(had a mental breakdown but I continues 😵‍💫)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git log --oneline --grep="multiversioning"&lt;/code&gt;&lt;br&gt;
This command gives you all the past commits displayed in one line containing the word "multiversioning". I got arounf 17 commits and 3 of them were useful.&lt;/p&gt;

&lt;p&gt;The commits are as follows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fta2yb8bed5ohuftmkdue.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fta2yb8bed5ohuftmkdue.png" alt="commit logs" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ones that I founf usefule were&lt;br&gt;
&lt;code&gt;"[aarch64] Add function multiversioning support"&lt;/code&gt;&lt;br&gt;
&lt;code&gt;"Add support for target version attribute"&lt;/code&gt;&lt;br&gt;
&lt;code&gt;"aarch64: Fix function multi versioning mangling "&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I investigated the first two commits and I could not find very useful code, but I needed to investigate these two commits to get an idea of how things work and how the function multi versioning is done. I investigated the first two and went off track forgetting that we need to update and not add FMV. Then I came to the third commit. &lt;br&gt;
To investigate any commit you can use the command.&lt;br&gt;
&lt;code&gt;git show &amp;lt;commit hash&amp;gt;&lt;/code&gt;&lt;br&gt;
After investigating this commit, you will see there are few lines that tell you which files were changed. And the address of the file. I tried to use the command &lt;code&gt;grep "target_clones"&lt;/code&gt;. But it froze my session. The correct way to do the grep along with the commit is the following.&lt;br&gt;
&lt;code&gt;git show &amp;lt;commit hash&amp;gt; | grep "taget_clones"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tlmow9qur0xyd3qiq28.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9tlmow9qur0xyd3qiq28.png" alt="Output" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is called piping. This gave me all the lines where the target clones were specified before the function. Now we need to find the function that contains the code for automatic FMV. Then I searched up the word clone and after so many occurrences I found a comment.&lt;br&gt;
&lt;code&gt;/*If the function in the node has multiple target attributes, create the appropriate clone for each valid target.*/&lt;/code&gt; &lt;br&gt;
The function definition looks like the following.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;statuc bool expand_target_clones(struct cgraph_nodes*node, bool definition)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This function takes in an array of target clones and the function definition to be cloned. It parses the comma separated target clones and verifies if the function is versionable by using the function that we discovered previously.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tree_versionable_function_p&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Cannot believe that it took me so much time. I was always searching for files with obvious names. But the actual file that was useful was &lt;code&gt;/gcc/gcc/multiple_targets.cc&lt;/code&gt;&lt;br&gt;
Then I started my work and hardcoded the array of target architectures needed and also made the definition being passed to be true to apply function multi versioning for all functions automatically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdz6qc3hr83morwyu3bvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdz6qc3hr83morwyu3bvc.png" alt="Image description" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklfe7tsem33z0eo0rh4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklfe7tsem33z0eo0rh4c.png" alt="Image description" width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now we need to test it. So I wrote a simple sum of array program and built it using O3 level optimization&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnuelziccxl08zu9yoyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvnuelziccxl08zu9yoyl.png" alt="Image description" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First I set the hard coded targets to be sve and sve2, but the program that I designed to test it did not compile because the target sve2 is not supported by GCC version 11.3.1. Which is the version that I'm using right now.&lt;/p&gt;

&lt;p&gt;So to know which targets are supported, I used the following command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gcc -E -march=help -xe /dev/null&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k5nta9mzqbr8beh90vi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1k5nta9mzqbr8beh90vi.png" alt="Image description" width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But this command  gave me an error, but it told me which targets are valid. And are supported target architectures by my current GCC version.&lt;/p&gt;

&lt;p&gt;Then I changed the hardcoded array to the preferred targets. Still I got the same error. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72bjq80wcvrdjr6ytx79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72bjq80wcvrdjr6ytx79.png" alt="Image description" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now I checked the file CPU info which is under the directory proc. And this file gave me the features of every processor. And also told me what all features are supported by each processor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33a4f7tgr0p8pjdyu3sv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33a4f7tgr0p8pjdyu3sv.png" alt="Image description" width="800" height="917"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping It Up: A Roller Coaster Ride in Code Land
&lt;/h2&gt;

&lt;p&gt;After navigating through a labyrinth of files, parsing through oceans of code, and deciphering the cryptic hieroglyphics that is GCC's inner workings, I finally emerged victorious! 🎉 Although I did face some hiccups with target architectures and GCC versions (who knew “sve2” was such a stickler for attention?), I’m now armed with knowledge and a few more grey hairs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Persistence Pays Off: It took a while to locate the right file (/gcc/gcc/multiple_targets.cc), but persistence led me to the treasure chest of FMV code.&lt;/li&gt;
&lt;li&gt;Tools are Your Friends: Commands like grep, find, and git show became my trusty sidekicks in this quest. (Seriously, I might name my next pet “grep”.)&lt;/li&gt;
&lt;li&gt;Know Your Limits: GCC version 11.3.1 has its own quirks, and knowing what your tools can and cannot do is half the battle.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lessons Learned:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stay Curious: Digging through the commits and code not only helped me understand FMV better, but also improved my detective skills (move over, Sherlock!).&lt;/li&gt;
&lt;li&gt;Stay Organized: Keep track of useful commands and file paths. It saves time and sanity in the long run.&lt;/li&gt;
&lt;li&gt;As I wrap up this chapter of my FMV journey, I look back and chuckle at the moment when I almost turned my keyboard into a Frisbee. 🥏 But hey, no keyboards were harmed in the making of this blog!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;Next up is testing the FMV with different GCC versions and refining my approach to cater to all the architectures out there (yes, even the picky ones like “sve2”). I’ll also be looking into more advanced optimizations and perhaps dabbling in some parallel processing fun.&lt;/p&gt;

&lt;p&gt;Stay tuned, dear readers, as I continue to unravel the mysteries of function multi versioning. And remember, if you ever find yourself lost in a sea of code, just keep swimming… and maybe bring a snorkel. 🏊‍♂️&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflections:
&lt;/h2&gt;

&lt;p&gt;This project was like a wild roller coaster ride—thrilling, sometimes dizzying, but ultimately satisfying. I’ve learned so much about GCC’s inner workings and realized that there’s always more to explore and improve. I plan to dive deeper into compiler optimizations and perhaps even contribute to the community.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links to My Code:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/YuktiMulani/gcc-fork"&gt;My GitHub Repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/YuktiMulani/gcc-fork/blob/1bb2535c7cb279e6aab731e79080d8486dd50cce/gcc/multiple_target.cc#L305"&gt;Specific FMV Changes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for joining me on this journey. Until next time, happy coding! 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Function Multi-Versioning: The Swiss Army Knife of Code</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 14 Jun 2024 21:21:45 +0000</pubDate>
      <link>https://dev.to/yuktimulani/function-multi-versioning-the-swiss-army-knife-of-code-5gdf</link>
      <guid>https://dev.to/yuktimulani/function-multi-versioning-the-swiss-army-knife-of-code-5gdf</guid>
      <description>&lt;p&gt;Hey tech tribe! 🗡️&lt;/p&gt;

&lt;p&gt;Let’s talk about something that’s got all the versatility of a Swiss Army knife – Function Multi-Versioning (FMV).I know I have talked about it before but trust me it is different this time. It’s not just a fancy term; it’s a game-changer for developers juggling different CPU architectures.&lt;/p&gt;

&lt;p&gt;Imagine you’re at a cook-off, and you’ve got to make a dish that impresses every judge with their unique tastes. That’s what FMV does for your code. You write a function, and FMV makes sure it’s the best darn function for every kind of CPU it might run on. Whether it’s x86-64 or aarch64, FMV has got you covered. It’s like having a single knife that can slice, dice, chop, and julienne – all with perfect precision! 🔪&lt;/p&gt;

&lt;p&gt;There are a few ways to use FMV. You can manually create different versions of your functions, or let the compiler do the heavy lifting with something called automatic cloning. It’s like having a sous-chef who not only preps all the ingredients but also makes sure every dish is seasoned to perfection.&lt;/p&gt;

&lt;p&gt;Our ultimate goal? To implement Automatic Function Multi-Versioning (AFMV) in GCC for aarch64. It’s the next evolution of FMV, making sure that your software isn’t just good, but great, no matter where it runs.&lt;/p&gt;

&lt;p&gt;So, here’s to FMV – the Swiss Army knife in your coding toolkit, ensuring your code is always sharp and ready to impress! 🥳&lt;/p&gt;

</description>
      <category>gcc</category>
      <category>afmv</category>
    </item>
    <item>
      <title>Automatic Function Multi-Versioning: The Lazy Programmer’s Dream!</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 14 Jun 2024 21:14:08 +0000</pubDate>
      <link>https://dev.to/yuktimulani/automatic-function-multi-versioning-the-lazy-programmers-dream-lbn</link>
      <guid>https://dev.to/yuktimulani/automatic-function-multi-versioning-the-lazy-programmers-dream-lbn</guid>
      <description>&lt;p&gt;Hey there, code wizards! 🧙‍♂️&lt;/p&gt;

&lt;p&gt;Imagine a world where you write a piece of code, sit back, and the computer magically makes it work on all kinds of different hardware. Sounds like a dream, right? Well, say hello to Automatic Function Multi-Versioning (AFMV) – the lazy programmer’s dream come true! 🌟&lt;/p&gt;

&lt;p&gt;In our quest to make GCC (GNU Compiler Collection) smarter, we’re implementing AFMV for the aarch64 architecture. What does this mean? It’s like having a genie who clones your functions into multiple versions, each tailored for different micro-architectural features. You don’t have to lift a finger (well, except for typing the initial code, but let’s not get picky!).&lt;/p&gt;

&lt;p&gt;Here’s the deal: normally, you’d have to write different versions of your functions to cater to various CPU features. It’s like making different kinds of pizzas for people with different tastes. One for the spicy lovers, one for the cheese enthusiasts, and one for the pineapple-on-pizza weirdos. 🍕 With AFMV, the compiler does this for you! It’s the ultimate life hack for programmers, reducing the time spent tweaking code for different hardware.&lt;/p&gt;

&lt;p&gt;So, next time you’re coding, remember that AFMV is like having your own personal genie in a bottle. Just make sure not to wish for infinite loops – those never end well!&lt;/p&gt;

&lt;p&gt;Thank you for reading!! Until next time happy coding!!🚀&lt;/p&gt;

</description>
      <category>afmv</category>
      <category>multiversioning</category>
      <category>assembly</category>
      <category>aarch64</category>
    </item>
    <item>
      <title>The Juggling Act of Multiple Architectures</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 14 Jun 2024 21:09:58 +0000</pubDate>
      <link>https://dev.to/yuktimulani/the-juggling-act-of-multiple-architectures-2h19</link>
      <guid>https://dev.to/yuktimulani/the-juggling-act-of-multiple-architectures-2h19</guid>
      <description>&lt;p&gt;Hey, folks! 🤹‍♂️&lt;/p&gt;

&lt;p&gt;Ever tried juggling flaming swords while riding a unicycle? No? Well, that’s pretty much what handling multiple computer architectures feels like! In our Software Portability and Optimization course, we’re diving deep into the world of x86-64 and aarch64 architectures. They’re like the Batman and Robin of computing, each with their own unique set of tricks and tools.&lt;/p&gt;

&lt;p&gt;These architectures come with a smorgasbord of micro-architectural features. Think of these as special moves in a video game – from cryptography acceleration to SIMD capabilities, each feature is like an extra power-up. But here’s the kicker: not all processors have all the features, so coding for them is like trying to write instructions for a treasure hunt in a mansion, not knowing if everyone has the same map!&lt;/p&gt;

&lt;p&gt;If you write software that relies on a feature not available on a user’s CPU, it’s game over. Literally. The software crashes. 💥 So, developers have to juggle – make the software flexible enough to run on any machine while also taking full advantage of any available superpowers.&lt;/p&gt;

&lt;p&gt;Multi-versioning comes to the rescue! 🦸‍♂️ It’s like preparing multiple versions of our treasure hunt instructions, each tailored for different maps. Whether it’s Library Multi-Versioning (LMV) duplicating whole libraries or Function Multi-Versioning (FMV) creating multiple versions of functions, it ensures that no matter what CPU the user has, they get the best possible performance. Now that’s some serious juggling!&lt;/p&gt;

&lt;p&gt;Thank you for reading.Until next time happy coding!!🚀&lt;/p&gt;

</description>
      <category>fmv</category>
      <category>lmv</category>
      <category>afmv</category>
    </item>
    <item>
      <title>SIMD and SVE: The Superheroes of Speed!</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Fri, 14 Jun 2024 21:05:59 +0000</pubDate>
      <link>https://dev.to/yuktimulani/simd-and-sve-the-superheroes-of-speed-566d</link>
      <guid>https://dev.to/yuktimulani/simd-and-sve-the-superheroes-of-speed-566d</guid>
      <description>&lt;p&gt;Hey there, fellow tech enthusiasts! 👋&lt;/p&gt;

&lt;p&gt;Let’s talk about some true unsung heroes of the computing world – SIMD and SVE. No, they’re not the latest Marvel superheroes (though they might as well be!). These acronyms stand for Single Instruction, Multiple Data (SIMD) and Scalable Vector Extensions (SVE). If you’re scratching your head wondering what they do, imagine a superhero with the power to handle multiple tasks simultaneously with lightning speed! ⚡️&lt;/p&gt;

&lt;p&gt;SIMD is like having a superhero team where each member can handle a different piece of the puzzle simultaneously, boosting performance without breaking a sweat. It’s a lifesaver when you’re dealing with large datasets, making your computer blaze through operations that would otherwise take forever.&lt;/p&gt;

&lt;p&gt;But wait, there’s more! Enter SVE and its sidekick SVE2, extensions designed to make our CPUs even more flexible and powerful. They’re like upgrading your superhero team with new gadgets and powers, allowing them to tackle an even broader range of challenges. 🚀&lt;/p&gt;

&lt;p&gt;So next time your computer zips through a complex task, give a nod to SIMD and SVE – the unsung heroes behind the scenes!&lt;/p&gt;

</description>
      <category>simd</category>
      <category>sve</category>
      <category>superheroes</category>
    </item>
    <item>
      <title>Project Stage-2 Implementation [part-1]</title>
      <dc:creator>Yukti Manoj Mulani</dc:creator>
      <pubDate>Thu, 13 Jun 2024 18:38:46 +0000</pubDate>
      <link>https://dev.to/yuktimulani/project-stage-2-implementation-part-1-1p4n</link>
      <guid>https://dev.to/yuktimulani/project-stage-2-implementation-part-1-1p4n</guid>
      <description>&lt;p&gt;Welcome to the SPO600 2024 Summer Project Stage-2! This summer, we're diving into the fascinating world of compiler optimization to build a prototype of Automatic Function Multi-Versioning (AFMV) for the GNU Compiler Collection (GCC) on AArch64 systems. In this blog, we’ll explore the context, for the Stage-2 of our project where we apply FMV to functions automatically, a key component of our project.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Task
&lt;/h2&gt;

&lt;p&gt;In this project we were assigned different roles since it is a very big process for every individual alone and we have less time. Imagine trying to understand the huge code base of GCC and then having almost 35 copies of the same project.😵‍💫 &lt;br&gt;
So now lets get to the point which is my task. I was assigned the task of applying FMV cloning to the functions automatically. Description: When the appropriate command-line options are provided, the compiler should automatically clone all functions, as if the target_clone attribute was specified.&lt;br&gt;
Now I know what questions are coming up in your mind , What FMV &lt;br&gt;
cloning actually is? and so on. &lt;br&gt;
I you wanna know then join me for this mini trip of applying FMV cloning.&lt;br&gt;
P.S. it might not be a "MINI" trip though.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Function Multi Versioning?
&lt;/h2&gt;

&lt;p&gt;Function Multi-Versioning (FMV) is an optimization technique used in modern computing to enhance the performance of programs by allowing different versions of a function to be generated and used based on the specific characteristics of the hardware or runtime environment. This approach can lead to more efficient execution by leveraging specialized hardware features or optimizations tailored to specific conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Concepts
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multiple Versions&lt;/strong&gt;: FMV involves creating multiple versions of a function, each optimized for different hardware capabilities or runtime scenarios. For example, a function might have one version optimized for CPUs that support a specific set of vector instructions and another version for older CPUs without these features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Selection Mechanism&lt;/strong&gt;: At runtime, the system determines which version of the function to execute based on the current environment. This decision is typically made using a selector function that checks the hardware capabilities or other relevant factors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hardware Specialization&lt;/strong&gt;: FMV is especially useful for exploiting hardware-specific features like vector extensions (e.g., AVX, SSE on x86 architectures) or specialized instruction sets available on newer processors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance Optimization&lt;/strong&gt;: By using the most appropriate version of a function for the given context, FMV can significantly improve performance, particularly in compute-intensive applications such as scientific computing, graphics processing, and machine learning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dynamic vs. Static Dispatch:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-&lt;strong&gt;Static Dispatch&lt;/strong&gt;: The selection of the function version &lt;br&gt;
happens at compile time. The compiler generates different &lt;br&gt;
code paths depending on compile-time checks or target &lt;br&gt;
specifications.&lt;/p&gt;

&lt;p&gt;-&lt;strong&gt;Dynamic Dispatch&lt;/strong&gt;: The function version is selected at &lt;br&gt;
runtime &lt;br&gt;
based on actual hardware detection or other runtime &lt;br&gt;
conditions.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compiler Support&lt;/strong&gt;: Modern compilers, such as GCC and Clang, often provide built-in support for FMV. They allow developers to specify different versions of a function and handle the dispatch logic automatically.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Benefits of Function Multi-Versioning
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Improved Performance&lt;/strong&gt;
: By using hardware-specific optimizations, FMV can enhance the execution speed of programs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: Programs can adapt to a wide range of hardware configurations without requiring multiple separate binaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backward Compatibility&lt;/strong&gt;: FMV allows newer code to run on older hardware by providing a version of functions that does not rely on newer, unsupported features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the next critical question arises that how do we do this FMV cloning thing? So, as you know lets discuss this in the next blog 😉&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5jxwyz1zlzbay1gvixb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5jxwyz1zlzbay1gvixb.gif" alt="Giggling child" width="498" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until then folks... Happy Coding!!!&lt;/p&gt;

</description>
      <category>functionmultiversioning</category>
      <category>aarch64</category>
      <category>gcc</category>
    </item>
  </channel>
</rss>
