{"id":14564,"date":"2026-11-13T12:03:38","date_gmt":"2026-11-13T20:03:38","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/directx\/?p=14564"},"modified":"2026-11-13T13:29:21","modified_gmt":"2026-11-13T21:29:21","slug":"machine-learning-compilers-challenges-hardware","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/directx\/machine-learning-compilers-challenges-hardware\/","title":{"rendered":"Challenges of building machine learning compilers across varying hardware architecture"},"content":{"rendered":"<p><span data-contrast=\"auto\">Contributors: Justin Stoecker, Sheil Kumar<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><strong>Overview<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;335559739&quot;:0,&quot;469777462&quot;:[10350],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><span data-contrast=\"auto\">One of the biggest challenges in building AI\/ML platform stacks for mobile, client, or server is creating a machine learning (ML) compiler that is both scalable yet performant. A common approach is to build specialized compilers for specific AI hardware, frameworks, or workload types. For example, independent hardware vendors (IHVs) provide their own frameworks to deploy models on their hardware, and PyTorch includes\u202ftorch.compile\u202fas a framework-specific compiler. Other ML compiler efforts include MLIR (Multi-Level Intermediate Representation), which also provides compiler frameworks like Glow, EON, and others. Each approach serves particular focus areas, but few are designed to deliver high performance for ML workloads while remaining independent of hardware vendor and framework.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0,&quot;469777462&quot;:[10350],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;335559739&quot;:0,&quot;469777462&quot;:[10350],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><span data-contrast=\"auto\">This post explores the challenges ML compiler developers face in pursuing strong performance without sacrificing scalability across diverse hardware architectures. It&#8217;s also a primer for\u202f<\/span><a href=\"https:\/\/ignite.microsoft.com\/en-US\/sessions\/BRK388\"><span data-contrast=\"none\">BRK388<\/span><\/a><span data-contrast=\"auto\">\u202fat Microsoft Ignite 2026, where we&#8217;ll go deeper on multi-level intermediate representations (IRs), including MLIR, and what they mean for local AI on Windows.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0,&quot;469777462&quot;:[10350],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;335559739&quot;:0,&quot;469777462&quot;:[10350],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><strong>Introduction<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Early graphics hardware began with fixed-function pipelines, which evolved into programmable shaders. The next leap introduced hybrid rasterization and ray tracing, and today these techniques are increasingly combined with neural graphics. Looking ahead, machine learning networks may play a larger role in rendering pipelines, changing how real-time graphics are built.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Deep neural networks are essentially graphs of mathematical operators, or layers. The natural instinct is to map this graph of operations to a graph of kernels, such as shaders. This approach feels intuitive and scalable but in practice, it\u2019s slow in reaching time to market agility and extremely difficult to scale across evolving hardware architecture. The challenge lies in optimizing key operators, which is deceptively hard. The breadth of hardware makes handwritten solutions difficult to scale, and the rapid pace of AI innovation compounds this problem. Individual operator performance is often not the primary bottleneck; the greater complexity comes from achieving efficient execution across diverse hardware and evolving model architecture.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><strong>Optimizing Individual Layers<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Matrix multiply-accumulate (MMA) is a core operator powering mainstream neural network architectures, including dense layers, MLPs, CNNs, and transformers. Dedicated MMA hardware has been present in GPU and NPU silicon for years and continues to expand. Naturally, this suggests we need a highly optimized MMA instruction at kernel level and modern hardware provides one. High-level abstractions provide portability but are often insufficient on their own to achieve hardware efficiency. Strong performance requires progressive lowering across multiple intermediate representation (IR) levels, enabling graph-level transformations, compute and memory fusion, hardware-aware tiling, data movement optimization, and execution scheduling that account for device-specific compute and memory hierarchies.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><strong>Device-Agnostic and Device-Aware Optimization<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Device-agnostic rewrites standardize and optimize common patterns of operators and can be enabled at the framework level. Device-aware rewrites, such as decompositions and fusions, are driven by the device architecture and its instruction set architecture (ISA), meaning the set of operations the device can execute without an additional trip to memory.<\/span> <span data-contrast=\"auto\">Pattern matching is one practical way to implement both, but it is not the only one. Infrastructure that supports both device-agnostic and device-aware graph optimization is an important early step for ML compilers that need to scale across hardware.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><strong>Fusion, Decomposition, and Control Access Layers<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">In languages with MMA support, the common expectation-versus-reality story is striking. You start with a model requiring X trillion operations (TOPS) and hardware claiming Y \u201cAI TOPS\u201d so you assume the model will run in X\/Y seconds. In practice, you may often achieve only 5\u201310% of the expected throughput. The reason lies in the compute-to-memory access ratio required to maximize hardware efficiency hundreds of operations per byte of DRAM access for high-end GPUs. Algorithmically, it\u2019s nearly impossible to reach this bar for most models if you process the network layer by layer. This is why operator fusion becomes critical, though the real questions remain: <\/span><b><span data-contrast=\"auto\">how much fusion is needed, and how much is even possible?<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Fusion might sound simple, such as combining two adjacent operators, but in reality, it\u2019s far more complex. It isn\u2019t limited to element-wise operation or linear chains of operations. To truly optimize, fusions need to span heavyweight operations like matrix multiplication, convolution, reduction, and upsampling.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Fusion and decomposition don&#8217;t necessarily map to kernel boundaries. They are part of a broader question of how control and information are exchanged between the layers of a compiler.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3 aria-level=\"1\"><strong>Spanning Layers and Abstraction Levels<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">It\u2019s best to think of fusion and decomposition as not purely about the scope of \u201ckernels,\u201d but as part of the broader problem of how control is shared across layers. In a cross-device ML compiler, sometimes you want to provide a backend with a large graph to reason about end-to-end execution. Sometimes you want to carve out subgraphs where hardware can do something special. And sometimes you need tile or kernel level control to squeeze out additional performance. In practice, this means any serious stack ends up spanning multiple IRs and abstraction levels.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">The tricky part isn\u2019t just having multiple layers &#8211; it\u2019s that responsibility gets split across them. This is where performance becomes surprisingly fragile. If an upper layer simply punts decisions downward (\u201cthe lower layer will optimize it\u201d), outcomes become hard to predict. It\u2019s not only about whether individual operators and data types are supported, but how efficiently\u202f<\/span><i><span data-contrast=\"auto\">patterns<\/span><\/i><span data-contrast=\"auto\">\u202fof connected operators are handled. Without proper understanding, the upper layer can\u2019t reliably tell which parts of the graph will stay on fast paths versus triggering slow paths, fallbacks, or late reshaping of the computation.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When those surprises happen late, they\u2019re expensive. You may have to backtrack and redo earlier choices specially for each hardware target, such as hand-editing models, changing how a compiler partitions the graph, how it orders transformations, or how it introduces tiling and layout, just to avoid unintended cliffs. This \u201cyou only find out at the end\u201d dynamic is one of the core challenges in building scalable, high-performance ML compilers across diverse hardware.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Approaching this problem purely as choice of static primitive granularity combined with greedy partitioning is often not enough. What\u2019s needed is a richer cooperative interface for sharing graph-level visibility and control across component layers.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><strong>Scheduling and Memory Management<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Optimizing machine learning workloads requires deep understanding of associated hardware architecture to be able to utilize hardware resources efficiently. This includes interconnected decisions around tensor layout, splitting and streaming algorithms, cache memory usage, data formats, tiling, and compute stencils. Equally critical is scheduling compute and memory tasks in a pipelined fashion, carefully balancing space, and time constraints to achieve optimal performance. As these software algorithms evolve, it\u2019s essential to maintain a dual focus: scalability across diverse platform architectures and maximizing device specific performance gains.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">These details are also highly coupled with hardware architecture details such as MMA sizes, on-chip memory capacity, register file limits, and data sharing and synchronization across threads, waves, thread groups, and clusters. For example, in client-side inference scenario, a real-time models might run with batch size 1 and strict latency requirements of around 2ms, making it impractical to shuttle large amounts of data through DRAM. In server-side inference, constraints can shift with high-bandwidth memory (HBM) and larger batch sizes.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">Equally important is scheduling compute and memory tasks in a pipelined fashion, carefully balancing space, and time constraints to achieve strong performance. As these software algorithms evolve, it&#8217;s important to maintain a dual focus: scalability across diverse platform architectures and maximizing device-specific performance gains.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Ultimately, executing complex networks efficiently is as challenging as building a high-performance rendering engine; it\u2019s far more than writing a single compute shader.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<h3><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><strong>Conclusion<\/strong><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:0,&quot;335559739&quot;:0}\">\u00a0<\/span><\/h3>\n<p><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><span data-contrast=\"auto\">The industry faces a broad challenge that calls for a unified platform-level solution, and it can be approached at two layers. At the higher level, solutions focused on frontend frameworks offer ease of use and often deliver good performance, but can face challenges with cross-device consistency, unified tooling, potentially unbounded compilation times, limited low-level control, and interoperability with graphics. At the lower level, solutions for individual operators can operate well with graphics and low-level engines and are generally independent of a specific hardware vendor. However, they require more effort to use and raise concerns around scalability and performance compared to vendor-specific solutions.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><span data-contrast=\"auto\">The solution likely lies between these levels. It calls for a structured process for defining use cases, understanding technical requirements, and making informed architectural decisions. We see an opportunity for Windows ML and DirectX to help address this challenge across a range of hardware architectures.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">As we look ahead, we will share more about how we&#8217;re approaching these challenges. What if developers could combine the scalability of a unified ML compiler architecture with the performance of hardware-specific optimization? We&#8217;re exploring how DirectX Compute Graph Compiler (DXCGC), Windows ML, and a multi-level IR architecture could help developers bring AI workloads to diverse hardware with greater consistency and portability.<\/span>\n<span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Stay tuned for Microsoft Ignite 2026 next week, where we will share more about our direction for local AI development on Windows in <\/span><a href=\"https:\/\/ignite.microsoft.com\/en-US\/sessions\/BRK388\"><span data-contrast=\"none\">BRK388<\/span><\/a><span data-contrast=\"auto\"> &#8211; be sure to check it out!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:300}\">\u00a0<\/span><\/p>\n<p>Additional Reference:<\/p>\n<ol>\n<li><span data-teams=\"true\"><a id=\"menurcdes\" class=\"fui-Link ___1q1shib f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1s184ao f1mk8lai fnbmjn9 f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn\" title=\"https:\/\/devblogs.microsoft.com\/directx\/evolving-directx-for-the-ml-era-on-windows\/\" href=\"https:\/\/devblogs.microsoft.com\/directx\/evolving-directx-for-the-ml-era-on-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Link Evolving DirectX for the ML Era on Windows - DirectX Developer Blog\">Evolving DirectX for the ML Era on Windows &#8211; DirectX Developer<\/a><\/span><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/foundry-on-windows\/machine-learning-compilers-challenges-hardware\/\">Machine Learning Compilers: Challenges Across Hardware<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Contributors: Justin Stoecker, Sheil Kumar\u00a0 \u00a0Overview\u00a0 \u00a0One of the biggest challenges in building AI\/ML platform stacks for mobile, client, or server is creating a machine learning (ML) compiler that is both scalable yet performant. A common approach is to build specialized compilers for specific AI hardware, frameworks, or workload types. For example, independent hardware vendors [&hellip;]<\/p>\n","protected":false},"author":178281,"featured_media":14583,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1232],"tags":[1235,1236,1237,1233,1234,1238,17],"class_list":["post-14564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-compute-graph-compiler","tag-compiler-optimizations","tag-intermediate-representations","tag-local-ai","tag-mlcompilers","tag-neuralrendering","tag-windowsml","tag-directx"],"acf":[],"blog_post_summary":"<p>Contributors: Justin Stoecker, Sheil Kumar\u00a0 \u00a0Overview\u00a0 \u00a0One of the biggest challenges in building AI\/ML platform stacks for mobile, client, or server is creating a machine learning (ML) compiler that is both scalable yet performant. A common approach is to build specialized compilers for specific AI hardware, frameworks, or workload types. For example, independent hardware vendors [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts\/14564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/users\/178281"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/comments?post=14564"}],"version-history":[{"count":2,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts\/14564\/revisions"}],"predecessor-version":[{"id":14582,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts\/14564\/revisions\/14582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/media\/14583"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/media?parent=14564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/categories?post=14564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/tags?post=14564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}