LLM Code Preprocessing for Performance-Portable Tensor Transpilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Legacy code bases, particularly in scientific computing, are challenging to port to modern hardware platforms due to their hardware-specific optimizations and lack of compatibility with modern tensor computation languages, requiring significant manual effort and being prone to errors.
Innovation Solution
A machine learning method using large language models (LLMs) to extract performance-critical code segments, generate ground truth data, and transpile legacy code into tensor computation language (TCL) candidates, with automated verification and optimization using compiler feedback.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If legacy code is manually ported to modern hardware platforms, then performance portability is improved, but development time and resource costs increase significantly
Solution Approach 1:
The patent replaces manual code porting (mechanical human effort) with an automated machine learning system that uses large language models to transpile legacy code to tensor computation language, dramatically reducing development time while maintaining performance portability
Solution Approach 2:
The patent introduces an intermediary ML-based transpilation system that acts as a mediator between legacy code and modern tensor computation platforms, automatically generating equivalent code without requiring manual intervention
2Power
If legacy code uses hardware-specific optimizations, then performance on specific hardware is improved, but compatibility with modern platforms deteriorates
Solution Approach 1:
The patent extracts hardware-specific optimization patterns from legacy code and translates them into equivalent tensor computation operations that work across modern platforms, preserving performance characteristics while improving compatibility
Solution Approach 2:
The patent transforms hardware-specific parameters and operations in legacy code into platform-agnostic tensor operations, changing the representation of computational parameters to achieve broad compatibility while maintaining performance
3Manufacturing precision
If manual code transpilation is performed, then accuracy of code transformation is improved, but productivity and automation level deteriorate
Solution Approach 1:
The patent implements a self-service automated transpilation system where the ML model autonomously performs code transformation, verification, and optimization without human intervention, achieving both high accuracy and productivity
Solution Approach 2:
The patent incorporates feedback mechanisms where the system verifies transpiled code against ground truth data and iteratively improves transformation accuracy, maintaining precision while enabling automated high-throughput processing
4Speed
If legacy code is rewritten in tensor computation language, then performance on modern hardware is improved, but error rate and resource intensity increase
Solution Approach 1:
The patent performs preliminary actions by generating ground truth data from legacy code before transpilation, establishing a reference for verification that catches errors early and reduces the error rate in final transpiled code
Solution Approach 2:
The patent uses feedback loops where transpiled code is automatically verified against ground truth data, identifying and correcting errors before deployment, thereby reducing error rates while maintaining high execution speed
Data Source
AI summary
A computer-implemented, machine learning method for preprocessing code for performance portability includes extracting performance critical code segments from an application and obtaining input data. Ground truth data is generated based on the input data and the application. Original code of the application is transpiled using a large language model (LLM) into a tensor computation language (TCL) candidate. Correctness of an implementation of the TCL candidate is verified using the ground truth data. The method has applications including, but not limited to, use cases in medical/healthcare, and other artificial intelligence applications for preprocessing and optimizing code for performance portability. The method can also support decision making and could be implemented with machine learning.


