Test case migration method, device, equipment and storage medium

By constructing constraint mapping relationships and adjusting test case elements, test case migration between different ISA chip platforms was achieved, overcoming the limitations of cross-ISA migration and improving the automation and usability of test cases.

CN123157533APending Publication Date: 2026-11-24MOORE THREADS TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611683675.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-28
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing test case migration methods only support migration between processors with different microarchitectures within the same ISA, and cannot migrate test cases across different ISAs, resulting in limited application scenarios.

Method used

By constructing constraint mapping relationships, the corresponding constraint relationships between the source chip platform and the target chip platform on the use case elements are indicated. The test cases to be migrated are parsed, and the use case elements are adjusted to adapt to the target chip platform, thereby realizing the cross-ISA migration of test cases.

Benefits of technology

There is no need to write test cases from scratch for the target chip platform, reducing development manpower investment, shortening the build cycle, improving the availability and automation of test cases after migration, and reducing the risks in the cross-instruction set adaptation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157533A_ABST
    Figure CN123157533A_ABST
Patent Text Reader

Abstract

The application discloses a test case migration method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: determining a test case to be migrated from a test case of a source chip platform; acquiring a constraint mapping relationship, which is used for indicating a constraint relationship corresponding to the source chip platform and a target chip platform on a case element; analyzing the test case to be migrated to obtain a first case element contained in the test case to be migrated; adjusting the first case element according to the constraint mapping relationship corresponding to the first case element to obtain a second case element; the test case to be migrated containing the second case element is a target test case; and the target test case is migrated to the target chip platform. The application supports migration and reuse of test cases between chip platforms with different instruction set architectures, greatly widens the reuse range of test cases, reduces the development workload of test cases, and shortens the time consumption of case construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a test case migration method, apparatus, device, and storage medium. Background Technology

[0002] With the explosive growth of AI (Artificial Intelligence) applications, more and more companies are developing their own ASIC (Application Specific Integrated Circuit) AI chips to gain performance and energy efficiency advantages for specific workloads. AI chips require a compiler to compile AI models into a sequence of executable instructions. The correctness of the compilation directly determines the accuracy and reliability of the inference results; therefore, compiler testing is a critical step before mass production. Currently, to accelerate chip development, migration test cases are commonly used to save time in building large-scale test cases.

[0003] In related technologies, one existing processor fuzzing technique utilizes the CB (Contextual Bandit) algorithm to intelligently adjust test cases that trigger exceptions on the original hardware instruction processor. These cases are then migrated to a new hardware instruction processor platform with the same instruction set architecture (ISA) for fuzzing, thereby enabling the reuse of test cases across different hardware instruction processors.

[0004] However, the above solution only supports migrating and reusing fuzz tests between processors that use the same ISA but differ only in microarchitecture, and does not support migrating test cases across different ISAs, which results in a significant limitation on the application scenarios of this solution. Summary of the Invention

[0005] This application provides a test case migration method, apparatus, device, and storage medium. The technical solution provided by this application includes the following aspects.

[0006] According to one aspect of the embodiments of this application, a test case migration method is provided, the method comprising: Identify the test cases to be migrated from the test cases of the source chip platform; Obtain constraint mapping relationships, which are used to indicate the constraint relationships between the source chip platform and the target chip platform on use case elements. Different types of use case elements correspond to different constraint mapping relationships. The test cases to be migrated are parsed to obtain the first test case elements contained in the test cases to be migrated; Based on the constraint mapping relationship corresponding to the first use case element, the first use case element is adjusted to obtain the second use case element; the test case to be migrated containing the second use case element is the target test case; The target test cases are migrated to the target chip platform.

[0007] According to one aspect of the embodiments of this application, a test case migration apparatus is provided, the apparatus comprising: The test case filtering module is used to determine the test cases to be migrated from the test cases of the source chip platform; The acquisition module is used to acquire constraint mapping relationships, which are used to indicate the constraint relationships between the source chip platform and the target chip platform on use case elements. Different types of use case elements correspond to different constraint mapping relationships. The parsing module is used to parse the test cases to be migrated to obtain the first test case elements contained in the test cases to be migrated; The adjustment module is used to adjust the first test case element according to the constraint mapping relationship corresponding to the first test case element to obtain the second test case element; the test case to be migrated containing the second test case element is the target test case; The migration module is used to migrate the target test cases to the target chip platform.

[0008] According to one aspect of the present application, a computer device is provided, the computer device including a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-described test case migration method.

[0009] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the above-described test case migration method.

[0010] According to one aspect of the embodiments of this application, a computer program product is provided, wherein a computer program is stored in a computer-readable storage medium, and a processor reads from the computer-readable storage medium and executes the computer program to implement the above-described test case migration method.

[0011] The technical solution provided in this application can bring the following beneficial effects: By identifying test cases to be migrated from the test cases of the source chip platform, and obtaining the constraint mapping relationship indicating the corresponding constraint relationships between the source and target chip platforms on the test case elements, different types of test case elements correspond to different constraint mapping relationships. After parsing the test cases to be migrated to obtain the first test case element, the first test case element is adjusted according to the constraint mapping relationship to obtain the second test case element. The test case to be migrated containing the second test case element is used as the target test case and migrated to the target chip platform. Therefore, this application can adapt and adjust various test case elements based on constraint mapping relationships, without having to write test cases from scratch for the target chip platform, reducing the manpower investment in test case development, shortening the test case construction cycle, and improving the automation level of cross-platform test case migration and the usability of the migrated test cases.

[0012] Compared to the aforementioned related technologies, this application constructs a constraint mapping relationship independent of the instruction set architecture. Based on this constraint mapping relationship, the first test case element in the test case to be migrated is adapted and adjusted, enabling the migration and reuse of test cases between different ISA chip platforms. This not only overcomes the limitations imposed by microarchitecture constraints under the same instruction set architecture, broadening the scope of application for test case reuse, but also reduces the risk of program runtime errors and calculation accuracy deviations during cross-instruction set adaptation based on the constraint mapping relationship, fully reusing mature test cases from the source chip platform. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 A flowchart of a test case migration method provided in an exemplary embodiment of this application is shown; Figure 2 This application illustrates a flowchart of obtaining a second use case element based on a first use case element, provided by an exemplary embodiment. Figure 3 This application illustrates a flowchart of a verification process for a target test case, provided by an exemplary embodiment of the present application. Figure 4 A flowchart illustrating a proposed test case retest suggestion is provided in an exemplary embodiment of this application. Figure 5 A flowchart illustrating the determination of test cases to be migrated, provided in an exemplary embodiment of this application, is shown. Figure 6An architectural block diagram of a test case migration system provided in an exemplary embodiment of this application is shown; Figure 7 This application illustrates a flowchart of adjusting and migrating test cases according to an exemplary embodiment. Figure 8 This invention provides a structural block diagram of a test case migration apparatus according to an exemplary embodiment of the present application. Figure 9 A structural block diagram of a computer device provided in an exemplary embodiment of this application is shown. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0016] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0017] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0018] It should be understood that although the terms first, second, etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, a first parameter may also be referred to as a second parameter, and similarly, a second parameter may also be referred to as a first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0019] First, let me introduce the relevant terms and concepts used in this application: A chip is a general term for semiconductor components, also known as an integrated circuit or microprocessor. It is a miniature electronic device that integrates a large number of electronic components (such as transistors, resistors, capacitors, etc.) onto a silicon wafer.

[0020] A chip platform is a complete and independent hardware and software co-computing foundation used in the semiconductor industry for chip design, development, testing, and production. It typically consists of a hardware layer, a software layer, and a service layer. The hardware layer achieves a balance between low power consumption and high performance through highly integrated design. For example, SoCs (System-on-Chip) using advanced process technologies (such as 7nm and 5nm) can integrate multiple modules such as CPUs (Central Processing Units), GPUs (Graphics Processing Units), and AI accelerators. The software layer provides end-to-end tools from design to verification. For instance, EDA (Electronic Design Automation) software supports logic design and placement / routing, while simulation environments can simulate chip performance in real-world scenarios. The service layer shortens development cycles and reduces costs through cloud collaboration and IP core reuse (reusing existing hardware modules).

[0021] As mentioned above, an AI accelerator refers to dedicated computing hardware specifically designed for artificial intelligence tasks (such as deep learning training and neural network inference). Its core objective is to efficiently and with low power consumption perform massive matrix multiplications, convolutions, and other AI-specific operations, overcoming the shortcomings of general-purpose CPUs and GPUs in running AI tasks, which are characterized by low efficiency and high power consumption. It is a type of dedicated computing processor. Any SoC, ASIC, or processor platform that integrates an AI acceleration module can be called a chip platform with an integrated AI accelerator.

[0022] AI chip platforms are dedicated chip platforms designed with AI training / inference as their core business objective. AI accelerators are the core components, while CPUs / GPUs serve only as auxiliary scheduling units. Examples include cloud-based inference acceleration ASICs, large-model training cards, and dedicated edge AI chips. The entire software and hardware toolchain, storage, and scheduling architecture are all optimized around tensor and neural network operations.

[0023] Operators are fundamental computational units used to perform specific mathematical operations and neural network model calculations. They are the core execution objects of AI chips, parsed by the compiler into standard operations that can be executed on the hardware computing array. Different chip platforms have different hardware computing power specifications and compiler IR (Intermediate Representation) systems, resulting in varying supported operator parameters and computational precision. Neural network models are constructed from a large number of different operators, such as convolution operators, pooling operators, matrix multiplication (MatMul) operators, activation operators (ReLU / Sigmoid), addition operators, and normalization operators.

[0024] Atomic operators (i.e., basic operators) are the smallest unit of operation that cannot be further divided, is natively implemented at the lowest level, and performs a single basic mathematical operation. Examples include Add, Sub, Mul, Div, Pow, Sqrt, and Neg.

[0025] Tensors are multidimensional arrays used in the field of AI to store computational data for neural network models. Tensor data consists of all computational data stored in a tensor, including images, features, weights, and biases. They serve as the input and output for AI operators.

[0026] Tensor shape is used to describe the dimensions of each dimension of multidimensional tensor data. It is generally expressed in the form of an array such as [N,C,H,W]. It represents the data length of the input / operation data of the neural network model in terms of batch, channel, height, and width. It is a core parameter for AI chip storage, block division, and operator operation.

[0027] Figure 1 A flowchart illustrating a test case migration method provided in an exemplary embodiment of this application is shown. The method is executed by a terminal device, client, or server. The method includes steps 110 to 150: Step 110: Identify the test cases to be migrated from the test cases of the source chip platform.

[0028] A chip platform is a complete hardware and software operating environment formed by hardware such as processors, microcontrollers, and bus control chips, along with development boards, EDA simulation tools, compilers, firmware, and debuggers (see the aforementioned glossary). Its core functions include instruction execution, peripheral interaction, memory read / write, and interrupt handling.

[0029] Because chip platform design involves high complexity in both hardware and software logic, theoretical design alone cannot guarantee a defect-free product. Therefore, chip platforms must use test cases. On the one hand, hardware RTL (Register Transfer Level) logic verification can be completed before tape-out (mass manufacturing of physical chips), allowing for early detection of circuit defects and identifying logic defects before tape-out to avoid huge losses due to chip failure after tape-out. On the other hand, it can verify the compatibility between the entire software toolchain, including compilers, firmware, and drivers, and the hardware.

[0030] A test case is a standardized test stimulus program that includes instruction sequences, register configurations, address read / write operations, peripheral input signals, and exception triggering conditions. It also includes the standard states, data, and timings that the hardware should output as a judgment benchmark.

[0031] In this embodiment of the application, test cases suitable for migration to the target chip platform for verification are selected from the complete set of test cases in the source chip platform. These selected test cases are also called test cases to be migrated. Subsequently, the test cases to be migrated are adaptively adjusted to obtain the target test cases, and the target test cases are migrated to the target chip platform.

[0032] In some embodiments, at least one of the source chip platform and the target chip platform is an AI chip platform. This includes the following scenarios: the source chip platform is an AI chip platform and the target chip platform is a non-AI chip platform; the target chip platform is an AI chip platform and the source chip platform is a non-AI chip platform; or both the source chip platform and the target chip platform are AI chip platforms.

[0033] The aforementioned AI chip platform is a complete hardware and software environment centered on a dedicated chip hardware integrating an AI accelerator, along with a development board, EDA simulation tools, a dedicated AI compiler, operator libraries, inference / training frameworks, and simulation debugging tools. This platform primarily performs neural network operators such as convolution, matrix multiplication, pooling, and activation, supplemented by CPU and GPU for task distribution and data preprocessing scheduling. It is mainly geared towards AI computing scenarios such as model training and edge / cloud inference. Its hardware computing array, on-chip cache partitioning mechanism, and compilation toolchain are all specifically optimized for tensor data and neural network operations.

[0034] Preferably, when the source chip platform is an AI chip platform, the target chip platform is also an AI chip platform. When the source chip platform is a non-AI chip platform, the target chip platform is also a non-AI chip platform. In other words, the two chip platforms for mutual migration of test cases are preferably of the same type. This is because the core verification objects of the test cases in AI chip platforms and non-AI chip platforms are completely different. Specifically, the core verification objects of test cases in non-AI chip platforms are general stimuli such as single instructions, register operations, peripheral read / write, interrupts, and one-dimensional memory access, while the core verification objects of test cases in AI chip platforms are AI operator operations such as convolution, matrix multiplication, and multi-dimensional tensors. The verification targets, data structures, and hardware computing units of the two are different. Even if a constraint mapping relationship is established to adjust the instruction test cases of the microcontroller / general-purpose CPU (Central Processing Unit) to an intermediate representation IR that can be recognized by the AI ​​chip compiler, and the adjusted target test cases are obtained, they can only verify the basic instruction functions of the AI ​​chip platform's built-in auxiliary CPU. They cannot verify the core computing power, tensor processing, operator accuracy, and other key performance of the AI ​​accelerator, thus failing to achieve the core purpose of AI chip verification.

[0035] In some embodiments, both the source chip platform and the target chip platform are non-AI chip platforms.

[0036] In some embodiments, based on the functional classification of test cases, only test cases that match the verification requirements of the target chip platform are selected as the objects to be migrated, while test cases of irrelevant types are discarded. For example, the source chip platform includes four types of test cases: convolution, pooling, peripheral read / write, and interrupt control. The target chip platform only needs to verify AI inference operators. Therefore, convolution and pooling operator test cases are selected as the test cases to be migrated, while peripheral read / write and interrupt control test cases are discarded.

[0037] In some embodiments, filtering rules are set according to the current verification phase requirements of the target chip platform to selectively extract test cases that match the verification requirements. For example, if the target chip platform is currently conducting on-chip cache performance verification, operator test cases with different tensor sizes and different memory alignment specifications are selected from the source chip platform and identified as test cases to be migrated.

[0038] Step 120: Obtain constraint mapping relationships. Constraint mapping relationships are used to indicate the constraint relationships between the source chip platform and the target chip platform on the use case elements. Different types of use case elements correspond to different constraint mapping relationships.

[0039] As mentioned above, test case elements refer to the core constituent units extracted from the parsing of a test case. A test case is composed of one or more test case elements. Specifically, after parsing, a complete test case can be broken down into test case elements such as operators, tensor shapes, data types, and memory resources.

[0040] In some embodiments, different types of test case elements include one or more of operators, tensor shapes, data types, and memory resources. Different types of test case elements correspond to different constraint mapping relationships. Therefore, constraint mapping relationships include one or more of the following: constraint mapping relationships corresponding to operators, constraint mapping relationships corresponding to tensor shapes, constraint mapping relationships corresponding to data types, and constraint mapping relationships corresponding to memory resources.

[0041] In some embodiments, a constraint mapping relationship is constructed. This constraint mapping relationship is generated based on the hardware characteristics of the source and target chip platforms and the conversion requirements of their respective compilers. It indicates the corresponding constraints on the use case elements of the source and target chip platforms. Before migrating test cases from the source chip platform to the target chip platform, all constraints on operators, tensor shapes, data types, and memory resources of both chip platforms are extracted and organized to generate a constraint mapping relationship. Subsequently, the test cases to be migrated are adjusted based on this constraint mapping relationship to ensure that the adjusted target test cases conform to the constraints of the target chip platform in terms of operators, tensor shapes, data types, and memory resources.

[0042] Step 130: parse the test cases to be migrated to obtain the first test case elements contained in the test cases to be migrated.

[0043] The above-described test case parsing involves decomposing the test cases into structured data. This structured data includes the input tensor definition, computation graph, expected output value, and test metadata. Based on this structured data, the first test case element is obtained from the test cases to be migrated. This first test case element includes at least one of the following: operator, tensor shape, data type, and memory resources.

[0044] The input tensor definition describes the input data object upon which test case calculations depend; it is a complete description of the multidimensional array participating in operator computation. This input tensor definition includes the tensor shape, data type, and initialization method. The tensor size characterizes the dimensions of each part of the tensor, and the data type identifies the precision of each element, such as float32, float16, or int8. The initialization method specifies the rules for generating the tensor's internal values, such as random initialization, all-zero initialization, fixed constant assignment, or loading from an external file.

[0045] The computation graph is the logical carrier of the entire test case, consisting of a set of operators executed in sequence, representing the complete data flow and computation process. This computation graph includes operator sequences and operator parameters. An operator sequence refers to the execution chain of operators based on their operational dependencies; for example, executing the matrix multiplication operator first, followed by the activation operator. Operator parameters are the configuration items required for each operator to run, such as kernel size, stride, padding, and dimension labels, used to control the specific operational behavior of the operator.

[0046] The expected output is the benchmark used to determine whether the calculation result is acceptable after the test case is executed. It comes in two forms: reference output value and constraint conditions. The reference value refers to the precise true value result calculated in advance. After running the test, the actual output value of the chip is compared with the reference output value item by item. The constraint conditions refer to the rules that do not require strict consistency of the values, but only limit the output value to meet, such as error range, output tensor shape constraints, and value interval constraints.

[0047] Test metadata consists of auxiliary configuration information attached to test cases. It does not participate in operator numerical calculations and is used to control the test execution process and test result determination. This test metadata includes tolerance thresholds, timeout periods, and test case tags. The tolerance thresholds determine whether the error between the actual and expected output values ​​of the operator is within an acceptable range. The timeout period refers to the maximum allowed runtime of the set test task; exceeding this timeout period indicates a test anomaly. Test case tags are used to categorize and label test cases, such as performance tests, functional tests, and operator-specific tests.

[0048] The test cases to be migrated are parsed to obtain the first test case elements contained within them. These first test case elements include at least one of operators, tensor shapes, data types, and memory resources. By performing structured parsing of the test cases to be migrated, the first test case elements can be decomposed and standardized for extraction.

[0049] Step 140: Adjust the first use case element according to the constraint mapping relationship corresponding to the first use case element to obtain the second use case element. The test case to be migrated containing the second use case element is the target test case.

[0050] In one embodiment, the first use case element includes at least one of an operator, a tensor shape, a data type, and a memory resource. For each of the at least one first use case element, the first use case element is adjusted according to the constraint mapping relationship corresponding to it to obtain a second use case element. For the test case to be migrated, after adjusting the at least one first use case element, the target test case is obtained.

[0051] For example, when the first use case element includes an operator, the first use case element is adjusted according to the constraint mapping relationship corresponding to the operator, and the adjusted first use case element is the second use case element.

[0052] For example, when the first use case element includes an operator, tensor shape, data type, and memory resources, the operator (i.e., the first use case element) is adjusted according to the constraint mapping relationship corresponding to the operator to obtain the adjusted operator (i.e., the second use case element). The tensor shape (i.e., the first use case element) is adjusted according to the constraint mapping relationship corresponding to the tensor shape to obtain the adjusted tensor shape (i.e., the second use case element). The data type (i.e., the first use case element) is adjusted according to the constraint mapping relationship corresponding to the data type to obtain the adjusted data type (i.e., the second use case element). The memory resource (i.e., the first use case element) is adjusted according to the constraint mapping relationship corresponding to the memory resource to obtain the adjusted memory resource (i.e., the second use case element). After completing the adjustments to the operator, tensor shape, data type, and memory resources for each test case to be migrated, the target test case corresponding to each test case to be migrated is obtained.

[0053] Step 150: Migrate the target test cases to the target chip platform.

[0054] In this embodiment of the application, after adjusting the test cases to be migrated as described above, target test cases corresponding to each migrated test case are obtained. The target test cases are migrated to the target chip platform for deployment, so that the target chip platform can load and run the target test cases to achieve test verification of the target chip platform.

[0055] The test case migration method provided in this application determines the test cases to be migrated from the test cases of the source chip platform, obtains the constraint mapping relationship indicating the corresponding constraint relationship between the source chip platform and the target chip platform on the test case elements, and different types of test case elements correspond to different constraint mapping relationships; after parsing the test cases to be migrated to obtain the first test case element, the first test case element is adjusted according to the constraint mapping relationship corresponding to the first test case element to obtain the second test case element, and the test case to be migrated containing the second test case element is used as the target test case and migrated to the target chip platform. Therefore, this application can adapt and adjust various test case elements based on constraint mapping relationships, eliminating the need to write test cases from scratch for the target chip platform, reducing the manpower investment in test case development, shortening the test case construction cycle, and improving the automation level of cross-platform test case migration and the usability of the migrated test cases.

[0056] Compared to the aforementioned related technologies, this application constructs a constraint mapping relationship independent of the instruction set architecture. Based on this constraint mapping relationship, the first test case element in the test case to be migrated is adapted and adjusted, enabling the migration and reuse of test cases between different ISA chip platforms. This not only overcomes the limitations imposed by microarchitecture constraints under the same instruction set architecture, broadening the scope of application for test case reuse, but also reduces the risk of program runtime errors and calculation accuracy deviations during cross-instruction set adaptation based on the constraint mapping relationship, fully reusing mature test cases from the source chip platform.

[0057] Figure 2 A flowchart illustrating an exemplary embodiment of this application is provided, showing how to obtain a second use case element based on a first use case element. This method is performed by a terminal device, client, or server. When the first use case element includes use case attribute information, step 140 is implemented by steps 210 to 220: Step 210: Determine the constraint relationships of the use case attribute information contained in the constraint mapping relationship corresponding to the first use case element.

[0058] Step 220: Adjust the first use case element according to the constraint relationship of the use case attribute information to obtain the second use case element.

[0059] Steps 210 to 220 will now be explained in detail.

[0060] When the first use case element includes use case attribute information, this use case attribute information corresponds to certain constraints, and these constraints exist within the constraint mapping relationship corresponding to the first use case element. When performing cross-platform adaptation adjustments for the test cases to be migrated, the constraints of the use case attribute information contained in the constraint mapping relationship corresponding to the first use case element are first determined. Then, the first use case element is adjusted according to the constraints of the use case attribute information to obtain the second use case element.

[0061] In other words, when adapting test cases for cross-platform migration, the constraint relationships for the test case attribute information are first extracted from the constraint mapping relationship corresponding to the first test case element. Based on the constraint relationships of this test case attribute information, the first test case element carrying the test case attribute information is adapted and adjusted as a whole, ultimately resulting in the second test case element that is fully adapted to the target chip platform.

[0062] For example, the data type of the first use case element is used as an example. The first use case element contains the use case attribute information of tolerance threshold. The tolerance constraint of the data type supported by the source chip platform is an absolute tolerance of 1e-5, while the tolerance constraint of the data type supported by the target chip platform is 1e-3. The data type of the test case to be migrated (i.e. the first use case element) is replaced with the data type supported by the target chip platform, and the tolerance of the data type of the test case to be migrated is modified to 1e-3.

[0063] In this embodiment, for the first use case element containing use case attribute information, the use case element is adapted and adjusted according to the constraint relationship of the use case attribute information contained in the constraint mapping relationship, which is different from the general overall element adaptation method. On the one hand, it can accurately locate the attribute dimensions in the first use case element that need to be adapted and adjusted, and only make targeted corrections to the use case attribute information that differs across platforms, while retaining the core operation logic of the use case element itself, which is legal and valid. The accuracy of the adaptation and adjustment is higher, and invalid or excessive modifications are avoided. On the other hand, automatic adaptation is completed according to the attribute constraint relationship corresponding to the use case attribute information, without the need for manual verification and manual configuration of various use case attribute information for different use case elements, which greatly simplifies the adaptation process of cross-platform test cases. At the same time, the adjustment based on the platform-specific attribute constraint rules can ensure that the various attribute information of the second use case element after adjustment is fully consistent with the hardware characteristics and operation constraints of the target chip platform. From the perspective of use case attribute information, it avoids problems such as operation accuracy deviation, memory overflow, and operation anomalies that occur after cross-platform migration, effectively improving the adaptation reliability and reuse success rate of test cases across architectures and platforms.

[0064] In some embodiments, the type of use case element includes an operator. The first use case element includes a first operator corresponding to the source chip platform. The second use case element includes a second operator corresponding to the target chip platform. The first operator is obtained by parsing the test case to be migrated. The use case attribute information includes operator parameters, and the constraints of the use case attribute information include: when mapping the first operator to the second operator, the intermediate operator corresponding to the first operator and the method for adjusting the operator parameters of the intermediate operator. The implementation of step 140 above includes: replacing the first operator with an intermediate operator. According to the operator parameter adjustment method, adjusting the operator parameters of the intermediate operator to obtain the second operator.

[0065] The first operator described above is obtained by parsing the test cases to be migrated. When the first test case element includes the first operator corresponding to the source chip platform, the test case attribute information included in this first test case element includes operator parameters.

[0066] The constraints on the use case attribute information mentioned above include: the intermediate operator corresponding to the first operator and the method for adjusting the operator parameters of the intermediate operator when mapping the first operator to the second operator. In other words, when the first use case element includes the first operator corresponding to the source chip platform, the constraints on the use case attribute information are: mapping the first operator in the test case to be migrated to the second operator corresponding to the target chip platform. Specifically, firstly, the first operator corresponding to the test case to be migrated is replaced with the intermediate operator corresponding to the first operator, and then the operator parameters of the replaced intermediate operator are adjusted. This completes the replacement of the first operator in the test case to be migrated with the second operator included in the target chip platform, thus completing the operator-level migration and adaptation.

[0067] For example, when the first use case element includes the first operator corresponding to the source chip platform as stablehlo.dot_general, based on the constraints of the use case attribute information, it can be determined that the intermediate operator corresponding to this first operator is target.matmul, and the operator parameter adjustment method for this intermediate operator target.matmul is to rearrange the dimension labels. That is, based on the constraints of the use case attribute information, firstly, the first operator stablehlo.dot_general corresponding to the test case to be migrated is replaced with the intermediate operator target.matmul corresponding to the first operator, and then the dimension labels of the replaced intermediate operator target.matmul are rearranged, thus completing the replacement of the first operator in the test case to be migrated with the second operator included in the target chip platform.

[0068] By leveraging the constraints of test case attribute information and combining the first operator with its corresponding intermediate operator, the method for adjusting the operator parameters of the intermediate operator after replacing the first operator is determined. The operator replacement is completed first, followed by operator parameter adaptation and adjustment to obtain the second operator. This ensures that the adjusted operator parameters conform to the input parameter specifications of the second operator in the target chip platform, avoiding compilation failures and runtime anomalies caused by direct operator replacement and parameter format mismatches. This achieves automated operator adaptation and conversion, eliminating the need for manual modification of operators and their parameters, improving the automation of operator conversion during test case migration, and ensuring that test cases after operator replacement can be used normally on the target chip platform.

[0069] In some embodiments, when the target chip platform does not support the composite dedicated operator of the source chip platform, it is necessary to combine multiple native basic operators in the target chip platform to equivalently implement the computational function of the composite dedicated operator in the source chip platform. This group of basic operators can be referred to as an operator subgraph.

[0070] In the above embodiments, the pre-built use case attribute information constraint relationship also records the correspondence between each operator in the source chip platform and the native operator and equivalent operator subgraph in the target chip platform.

[0071] For example, when the source chip platform includes a self-developed composite INT16 fused convolution operator, while the target chip platform does not support this dedicated composite operator and only supports basic convolution operators and bias addition operators, the constraint relationship of the test case attribute information is configured as follows: the composite convolution operator in the test case to be migrated is mapped to an operator subgraph composed of basic convolution operators and bias addition operators, and a precision transformation rule is configured to adjust the INT16 operator parameters to FP16. After parsing the test case to be migrated and identifying the composite INT16 convolution operator, according to the constraint relationship of the test case attribute information, the composite convolution operator in the test case to be migrated is removed and replaced with an operator subgraph composed of serially arranged basic convolution operators and bias addition operators. At the same time, the data type adaptation modification is completed, and the complete calculation logic of the composite convolution operator in the source chip platform is equivalently implemented on the target chip platform.

[0072] One optional implementation method includes one or more of the following: rearranging dimension labels, mapping after conversion according to fill format, mapping after splitting according to reduction operator type, and no mapping.

[0073] In this implementation, when some test cases to be migrated in the source chip platform use a StableHLO operator computation graph as the original input, and the computation graph contains StableHLO operators, the StableHLO operators are hardware-independent, cross-framework general high-level intermediate representation operators. These are not native operators of the source chip platform hardware, but rather standard computation description languages ​​derived from mainstream deep learning models, including common operations such as convolution, matrix multiplication, addition, and bias addition. For the conversion scenario from the high-level intermediate representation operator (i.e., the first operator) to the instruction set operator (i.e., the second operator) in the target chip platform, if the mathematical semantics of the first and second operators are consistent but the tensor dimension definitions differ, the first operator is first replaced with the intermediate operator, and then the dimension labels of the replaced intermediate operator are rearranged. After rearrangement, the second operator is obtained, thus completing the mapping of the first operator in the test cases to be migrated to the second operator. If the operational functions of the first and second operators are equivalent but the padding parameter specifications differ, the padding format is first converted before completing the one-to-one mapping. If a high-level intermediate representation operator cannot correspond to a single low-level operator, it is split into multiple low-level operators to form an equivalent operator subgraph based on the type of operation. If there is no matching low-level operator for the high-level intermediate representation operator in the target chip platform, a skip or no-operation replacement process is performed without mapping. In actual conversion, a single processing method can be used, or multiple methods can be combined for collaborative processing. Therefore, by setting various operator parameter adjustment methods through the constraint relationships of the test case attribute information, the appropriate method can be flexibly selected according to the actual scenario: rearranged dimension labels, mapping after conversion according to the filling format, mapping after splitting according to the reduction operator type, or no mapping. This enriches the cross-platform operator adaptation methods, effectively improves the operator portability range, and clearly distinguishes unsuitable operators, ensuring that the test case operator adjustment process is stable and controllable.

[0074] Below, with reference to Table 1, we will provide an example of the constraint relationships for use case attribute information, including operator parameters.

[0075]

[0076] As shown in Table 1, the constraint relationship of test case attribute information between the StableHLO operator (i.e., the first operator) in the source chip platform and the second operator in the target chip platform is defined in the constraint relationship of test case attribute information. The intermediate operator corresponding to the first operator is defined in the constraint relationship of the test case attribute information, as well as the operator parameter adjustment method for the intermediate operator. By replacing the first operator in the test case to be migrated and adapting and adjusting the operator parameters of the intermediate operator, the second operator of the target chip platform is finally obtained.

[0077] When the first operator is `stablehlo.dot_general` and the intermediate operator is `target.matmul`, replacing the first operator `stablehlo.dot_general` with the intermediate operator `target.matmul` and then rearranging the dimension labels of the replaced intermediate operator completes the replacement of the first operator with a second operator adapted to the target chip platform. When the first operator is `stablehlo.convolution` and the intermediate operator is `target.conv2d`, replacing the first operator `stablehlo.convolution` with the intermediate operator `target.conv2d` and then converting the replaced intermediate operator according to the padding format completes the replacement of the first operator with a second operator adapted to the target chip platform. When the first operator is stablehlo.reduce and the intermediate operator is target.reduce_sum+target.reduce_max (i.e., combined operators), after replacing the first operator stablehlo.reduce with the intermediate operator target.reduce_sum+target.reduce_max, the replaced intermediate operator is split according to the reduce type, thus completing the replacement of the first operator with the second operator adapted to the target chip platform.

[0078] When the first operator is stablehlo.custom_call(“Sharding”), if there is no corresponding intermediate operator in the constraint relationship of the use case attribute information for the first operator, no mapping is performed for the first operator, or the no-op operator is used as the intermediate operator, and the first operator stablehlo.custom_call(“Sharding”) is replaced with the no-op operator to obtain the second operator, thereby realizing the adaptation processing that skips the original sharding logic.

[0079] When the first operator is stablehlo.all_reduce and the intermediate operator is target.ring_allreduce, after replacing the first operator stablehlo.all_reduce with the intermediate operator target.ring_allreduce, the communication topology is adapted and modified according to the adjustment method to obtain a usable second operator.

[0080] In one optional implementation, for each third operator included in the test case to be migrated, if there is no third operator and its corresponding substitute operator within the target chip platform, the third operator and its corresponding subgraph are deleted from the test case. Here, the third operator is any one of the operators included in the test case to be migrated. In this implementation, each operator in the test case is traversed and parsed as a third operator to be processed. If it is determined that the target chip platform has neither a native operator that can directly match the third operator nor an operator with similar computational function that can be equivalently substituted, then the third operator is directly removed from the current test case computation graph, and the operator subgraph bound to and performing computations with the third operator is also deleted.

[0081] The above processing method can eliminate operators and their corresponding subgraphs that are not supported by the target chip platform and have no equivalent alternatives. On the one hand, it eliminates compilation exceptions and process interruption problems caused by unknown operators, ensuring that test cases can be compiled and deployed normally. On the other hand, it simplifies the scale of the computation graph, reduces memory usage and computation scheduling overhead, and speeds up simulation verification. At the same time, it eliminates the need to develop complex adaptation and conversion logic for invalid operators, reduces the development and debugging costs of cross-platform adaptation, and avoids invalid calculations from interfering with the test results of hardware performance and accuracy, thereby improving the validity and reliability of verification data.

[0082] In some embodiments, before deleting the third operator and its corresponding subgraph from the test case, the test case migration method provided in this application further includes steps A1-A4: Step A1: Search the equivalent computation graph database for candidate alternative subgraphs composed of operators supported by the target chip platform. The candidate alternative subgraphs are used to equivalently implement the computation function of the third operator.

[0083] Step A2: Perform at least one verification on the candidate alternative subgraph, including one or more of the following: shape consistency verification, data type validity verification, sampled numerical equivalence verification, and computational envelope verification.

[0084] Step A3: If at least one verification passes, replace the third operator in the test case with a candidate alternative subgraph.

[0085] Step A4: If no candidate alternative subgraph is found in the equivalent computation graph database, or if at least one verification fails, perform the step of deleting the third operator and the subgraph corresponding to the third operator from the test case, or mark the third operator as non-transferable.

[0086] The following is a detailed explanation of steps A1-A4.

[0087] First, the equivalent computation graph database is searched for all candidate replacement subgraphs composed of operators natively supported by the target chip platform and capable of equivalently performing the third operator's operation. The selected candidate replacement subgraphs are then validated. Validation items can include one or more of the following: tensor shape consistency verification, data type validity verification, sampling numerical equivalence verification, and computational envelope verification, ensuring that the replacement subgraphs meet the requirements in terms of hardware constraints, computational accuracy, and computational overhead. If a candidate replacement subgraph successfully passes all selected validations, the original operator is not deleted, and the third operator in the test case is replaced with this candidate replacement subgraph, achieving effective test case migration. If no available candidate replacement subgraph exists in the equivalent computation graph database, or if the candidate replacement subgraph fails the preset validations, the replacement operation is not performed. Instead, the third operator and its corresponding subgraph are deleted, or the third operator is marked as non-migratable, thus completing the test case pruning process.

[0088] The above implementation prioritizes equivalent replacement before deleting the third operator and its corresponding subgraph. It first searches the equivalent computation graph database for candidate replacement subgraphs that can equivalently implement the third operator's function and are composed of operators supported by the target chip platform. Multiple verifications are then performed on these candidate replacement subgraphs, including shape consistency, data type validity, sampled numerical equivalence, and computational envelope. Operator replacement is completed when a candidate replacement subgraph passes verification. The third operator and its subgraph are only deleted or marked as non-transferable if no candidate replacement subgraph is found or verification fails. This approach maximizes the preservation of original test cases and test scenarios, reduces the loss of test coverage scenarios, improves test case reusability, and ensures that the replaced computation graph adapts to the target chip platform's hardware constraints, avoiding a significant loss of test cases due to direct operator trimming.

[0089] In some embodiments, the type of use case element includes a tensor shape. The first use case element includes a first tensor shape corresponding to the source chip platform. The second use case element includes a second tensor shape corresponding to the target chip platform. The first tensor shape is obtained by parsing the test case to be migrated. The use case attribute information includes the target tile of the tensor shape, where the tile is a block size unit. The constraint relationship of the use case attribute information includes: when mapping the first tensor shape to the second tensor shape, the alignment requirement for tensor shape alignment based on the target tile, the alignment requirement includes upward alignment to an integer multiple of the target tile. When the first use case element includes the first tensor shape corresponding to the source chip platform, the above step 140 is implemented by: aligning the first tensor shape upward to an integer multiple of the target tile to obtain the second tensor shape.

[0090] In this embodiment, the internal computing unit of the target chip platform has inherent hardware tile size constraints. When the hardware performs tensor operations, the dimensions of the input tensor must be an integer multiple of the tile size; otherwise, the hardware cannot process it directly. The test case attribute information includes the target tile shape of the tensor. After parsing the original tensor shape from the source chip platform from the test cases to be migrated, the tile size corresponding to the computing unit of the target chip platform, i.e., the size of the target tile, is read. The dimensions of the tensor are aligned, padding each dimension to an integer multiple of the target tile size to obtain the aligned tensor shape, thus adapting it to the computing requirements of the target chip platform.

[0091] By aligning the tensor shape according to the target tile size of the computing unit in the target chip platform, ensuring that the aligned tensor shape is an integer multiple of the target tile size, the hardware computing unit of the target chip platform has strict requirements for tensor dimensions. This avoids hardware operation errors and abnormal calculation results caused by tensor dimensions not meeting the target tile multiple, thus improving the success rate of test cases running on the target chip platform after migration. Simultaneously, the logical semantics of the original tensor are preserved, ensuring the effectiveness of test case verification.

[0092] In some embodiments, where the tile size and memory alignment standards of hardware computing units differ across different chip platforms, the following can be used: The function implements shape alignment. Specifically, the... The function is a tensor shape transformation tool, with input parameters. The original tensor shape representing the source chip platform. The tile size represents the source chip platform. The tile size represents the target chip platform. The function iterates through the values ​​of each dimension of the tensor shape of the source chip platform. If this dimension can be determined by the tile size of the target chip platform If the result is divisible, it means the current dimension meets the hardware alignment requirements of the target chip platform, and the corresponding dimension of the target chip platform tensor will directly use its original value. If the result is not divisible, then the smallest integer multiple will be rounded up. The new dimension value is used to complete the alignment and padding, and the final output is the target chip platform tensor shape that adapts to the target chip platform's block and alignment constraints. .

[0093] ( , , ): / / for Each dimension d: : / / Aligned, no adjustment needed else: / / Align upwards return

[0094] For example, the source chip platform is a commercial AI chip platform with a hardware tile size of 128×128, and the target chip platform is a self-developed ASIC with a hardware tile size of 64×64, requiring that the values ​​of each dimension of the tensor must be integer multiples of 64. When adjusting the shape of the test case tensor according to the tensor shape mapping rules, the alignment of each dimension of the source chip platform tensor is verified based on the tile specifications of the two chip platforms. Both dimensions are divisible by the tile size 64 of the target chip platform, satisfying memory alignment and block requirements. Therefore, the original size is directly retained as the tensor shape of the target chip platform, while the tensor shape of the source chip platform is... The first dimension, 128, is a multiple of 64 and remains unchanged. The second dimension, 130, is not divisible by 64, so the minimum value of 192, which is greater than 130 and a multiple of 64, is selected to complete the dimension upward padding, ultimately yielding a tensor shape adapted to the block division rules of the target chip. This ensures that all tensor data conforms to the dimensions and hardware block constraints of the target chip platform.

[0095] In one optional implementation, for tensors with dynamic shapes, during migration, the shape constraints of the source chip platform are first mapped to the target chip platform. Then, the intersection of the mapped shape constraints and the logical shape constraints of the target chip platform is taken, and this intersection is determined as the migrated shape constraints. Here, a tensor with dynamic shapes differs from a static tensor whose shape and size are completely locked during the compilation phase. Dynamic shapes mean that one or more dimensions of the tensor are not written as fixed values ​​during compilation; their specific shape and size are determined only during the actual program execution phase. Furthermore, these dimension values ​​also come with upper and lower limits, inter-dimensional constraints, and integer division requirements for block sizes.

[0096] For example, the shape constraints supported by the source chip platform during compilation are: The target chip platform supports the following shape constraints during compilation: Take the intersection of the shape constraints supported by the two chip platforms during compilation. The intersection is then defined as the shape constraint after migration.

[0097] When the intersection is exactly the same as the shape constraint of the source chip platform, it indicates that the target chip platform can fully support the entire dynamic shape dimension value range of the source chip platform. Under hardware limitations, the original dynamic shape value range will not be compressed. The test logic and test scenarios corresponding to this shape constraint can be completely migrated as is, and the original verification semantics will not be lost. For example, the dimension range of the dynamic shape constraint supported by the source chip platform. The target chip platform also supports This means that the tensor shape of the test cases can be directly transferred without modification.

[0098] When the intersection is non-empty and smaller than the shape constraints of the source chip platform, it indicates that the target chip platform cannot fully accommodate the entire range of dynamic shape dimensions of the source chip platform. Only this intersection is used as the transferred shape constraint, while the tensor shapes in the source chip platform that exceed the hardware capabilities of the target chip platform or cannot be transferred are recorded. For example, the dimensional range of dynamic shape constraints supported by the source chip platform. The target chip platform supports Then only shape constraints will be applied. The corresponding test logic and test scenarios were migrated to the target chip platform and recorded. This part of the shape is missing. Among them, The shape of this tensor exceeds the hardware capabilities of the target chip platform, making it impossible to handle. The corresponding test logic and test scenarios can be directly migrated and reused. Therefore, for this part of the shape coverage missing, separate supplementary test cases can be arranged in the future.

[0099] When the intersection is empty, it indicates that the range of all dynamic shape values ​​of the source chip platform is not within the support range of the target chip platform, and there is no adaptable legal tensor shape. The test case as a whole is determined to be untransferable, and it is forbidden to replace it with another tensor shape to avoid distortion of the test scenario and complete deviation of the test purpose.

[0100] In some embodiments, the type of use case element includes a data type. The first use case element includes a first data type corresponding to the source chip platform. The second use case element includes a second data type corresponding to the target chip platform. The first data type is obtained by parsing the test cases to be migrated. The use case attribute information includes the tolerance of the data type, and the constraints of the use case attribute information include: when mapping the first data type to the second data type, the third data type corresponding to the first data type and the tolerance adjustment method for the third data type.

[0101] When the first use case element includes a first data type corresponding to the source chip platform, the implementation of step 140 above includes: replacing the first data type with a third data type; and adjusting the tolerance of the third data type according to the tolerance adjustment method to obtain a second data type.

[0102] In this embodiment, the data type obtained from the parsed test cases to be migrated, combined with the set of data types actually supported by the target chip platform hardware, and based on the constraints of the test case attribute information, determines both the third data type corresponding to the first data type and the tolerance adjustment method for the third data type. Then, the first data type in the test cases is replaced with the third data type, and the tolerance threshold of the replaced third data type is adjusted according to the tolerance adjustment method.

[0103] For example, the first data type obtained by parsing the test cases to be migrated is BF16. Since the target chip platform does not support this first data type BF16, the third data type is determined to be FP32 based on the constraint relationships of the test case attribute information. The tolerance adjustment method is determined to be to reduce the relative tolerance from 1e... 3 adjusted to 1e 4. Then replace the first data type with the third data type, and change the relative tolerance of the replaced third data type from 1e. 3 adjusted to 1e 4. Obtain the second data type.

[0104] By determining the third data type corresponding to the first data type and the corresponding tolerance adjustment method based on the constraint relationship of the test case attribute information, the tolerance threshold is updated synchronously while the data type replacement is completed. This can match the numerical precision characteristics of the converted data type itself, avoid the data type changing but the tolerance maintaining the original value, which would cause test misjudgment, prevent test cases that should have passed from being incorrectly judged as failing, or defective test cases from being incorrectly released, realize the automatic matching and adaptation of data type and tolerance, reduce manual correction work, and improve the accuracy of test case result judgment after migration.

[0105] In one optional implementation, the tolerance adjustment method includes one or more of the following: one-to-one replacement with unchanged tolerance, precision conversion with relaxed tolerance, format conversion with dynamic tolerance adjustment, and downgrade mapping with recalibrated parameters.

[0106] In this implementation, when the data type precision specifications of the source and target chip platforms are consistent, a one-to-one replacement tolerance adjustment method with unchanged tolerance is adopted. This rule directly replaces the data type, and the tolerance corresponding to the precision verification retains the original value without modification. When there is a difference in data type precision between the source and target chip platforms, a precision conversion and tolerance-widening tolerance adjustment method is adopted. This rule expands the allowable error range synchronously after data type replacement to adapt to the calculation error caused by precision change. When the data storage formats such as floating-point and fixed-point are different between the source and target chip platforms, a format conversion and dynamic tolerance adjustment method is adopted. This rule flexibly adjusts the matching tolerance based on the characteristics of the data format itself. When converting from a high-precision data type on the source chip platform to a low-precision quantization type on the target chip platform, a downgrade mapping and recalibration tolerance adjustment method is adopted. In addition to data type replacement and tolerance threshold adjustment, this rule also needs to recalculate and configure quantization-related parameters such as quantization zero point and scaling factor to ensure controllable accuracy of quantization operations. Therefore, by providing multiple tolerance adjustment methods, it is possible to flexibly choose one-to-one replacement with unchanged tolerance, precision conversion with relaxed tolerance, format conversion with dynamic tolerance adjustment, and downgrade mapping with recalibrated parameters according to the differences in chip platforms. This balances the legality of calculations with the rationality of numerical verification, effectively improving the runnability and verification accuracy of test cases after cross-platform migration.

[0107] In some embodiments, when the data type of the test case to be migrated is inconsistent with the data type supported by the target chip platform, the tolerance of the test case to be migrated on that data type is adjusted according to the difference in calculation path. The specific adjustment method can be referred to Formula 1.

[0108] Formula 1 in, This is the path difference compensation factor (default setting is 1.5). For the machine precision of the target chip platform. For the machine precision of the source chip platform To accommodate the tolerance of the source chip platform, This refers to the tolerance of the target chip platform.

[0109] For example, in conjunction with Table 2, the constraint relationships of use case attribute information, including the tolerance of data types, are illustrated.

[0110]

[0111] Table 2 shows the constraint relationships of test case attribute information when adapting and migrating test cases from the source chip platform to the target chip platform. When the data types supported by the source and target chip platforms are completely identical, such as the first data type supported by the source chip platform and the second data type supported by the target chip platform both being BF16, or the first data type supported by the source chip platform and the second data type supported by the target chip platform both being FP32, a direct mapping strategy is adopted, and the tolerance threshold used for verification remains unchanged. When the first data type supported by the source chip platform is BF16 while the second data type supported by the target chip platform is FP16, and there is a difference in the precision specifications of the two data types, a precision conversion strategy is executed, and the tolerance is widened to twice that of FP16 (i.e., BF16). The machine precision is used to compensate for computational errors caused by precision conversion. When the source chip platform supports FP8 (E4M3) as the first data type, while the target chip platform supports FP8 (E5M2) as the second data type, a format conversion strategy is executed for floating-point formats with the same bit width but different exponent mantissa allocation. The verification tolerance is dynamically adjusted based on the ratio of the dynamic range of the two formats. When the source chip platform supports INT8 quantization type as the first data type, but the target chip platform does not support this data type, a downgrade mapping method is adopted. The data type can be converted to INT16 or the corresponding calculation branch can be skipped directly. At the same time, the quantization parameters such as zero point and scaling factor are recalibrated to ensure that the quantization operation precision is controllable.

[0112] In some embodiments, the type of use case element includes memory resources. The first use case element includes a first memory resource corresponding to the source chip platform. The second use case element includes a second memory resource corresponding to the target chip platform. The first memory resource is obtained by parsing the test case to be migrated. The use case attribute information includes batch size and / or tensor block size. The constraint relationship of the use case attribute information includes: when mapping the first memory resource to the second memory resource, the batch size adjustment method and / or tensor block size adjustment method corresponding to the first memory resource. When the first use case element includes the first memory resource corresponding to the source chip platform, the implementation of step 140 above includes: adjusting the batch size on the first memory resource according to the batch size adjustment method, wherein the adjusted batch size is greater than or equal to 1. And / or, adjusting the tensor block size on the first memory resource according to the tensor block size adjustment method to obtain the second memory resource, so as to block the input tensor of the test case to be migrated according to the adjusted tensor block size, so that the block tensor block size adapts to the memory resource constraints of the target chip platform.

[0113] The batch size mentioned above refers to the data throughput capability of the chip platform. The tensor partitioning factor is a coefficient used to control the granularity of tensor partitioning. The tensor partitioning size is the size of each sub-tensor after partitioning, and is a memory resource constraint parameter.

[0114] In this implementation, when the first use case element includes the first memory resource corresponding to the source chip platform, and the second use case element includes the second memory resource corresponding to the target chip platform, the use case attribute information includes the batch size and / or tensor block size. First, the batch size is scaled to fit the memory bandwidth ratio of the source and target chip platforms, ensuring that the adjusted batch size is not less than 1 to avoid invalid 0 values. Then, the memory working set required for the test case execution is determined. If the memory working set exceeds the maximum capacity of the target chip platform's on-chip static random access memory (SRAM), a tensor block factor is calculated. Subsequently, the input tensor is block-processed based on this tensor block factor, ensuring that the size of each block conforms to the hardware limitations of the target chip platform's memory resources, allowing tensor data to be stored in blocks in the on-chip SRAM for computation. Here, the memory working set refers to the total amount of data that needs to be loaded into the on-chip SRAM simultaneously during the test case computation.

[0115] For example, the source chip platform has a memory bandwidth of 100GB / s, and the target chip platform has a memory bandwidth of 50GB / s, with a memory bandwidth ratio of 0.5. The batch size of the test cases is 8, which is adjusted to 4 after calculation to satisfy a value greater than or equal to 1. The memory working set size of the test cases is 128MB, while the maximum capacity of the target chip platform's on-chip static random access memory is only 64MB. The memory working set exceeds the hardware capacity. The ratio of the test case's memory working set size to the maximum capacity of the target chip platform's on-chip static random access memory is determined as the tensor block factor, which is calculated to be 2. The original input tensor is divided into two blocks according to the tensor block factor of 2. Each tensor block size corresponds to a memory occupation of 64MB, and each block can be loaded into the target chip platform's on-chip static random access memory for computation.

[0116] This embodiment uses batch size and tensor block size as constraints on memory resources. On one hand, it adjusts the batch size according to the memory bandwidth ratio to ensure that the data throughput of the target chip platform matches the computational load of the batch processing. On the other hand, when the memory working set exceeds the capacity of the on-chip static random access memory, the input tensor is blocked using a tensor block factor, ensuring that the size of the block is adapted to the upper limit of the target platform's memory. This avoids problems such as test case failures and memory overflows caused by batch processing load mismatch or tensor data exceeding the on-chip storage capacity. It achieves automatic adaptation at the memory resource level, eliminating the need for manual modification of the test case load and tensor block configuration, and improving the success rate of test case migration.

[0117] In some embodiments, where the hardware memory access bandwidth and on-chip SRAM storage capacity hardware constraints differ across different chip platforms, the following can be used: This function implements memory resource adaptation. The input parameters of this function are... This represents the original memory resource configuration of the source chip platform. , These are the hardware memory access bandwidth limits for the source and target chip platforms, respectively. , These represent the on-chip SRAM storage capacities of the source and target chip platforms, respectively. The function first calculates a scaling factor using the ratio of the target chip platform bandwidth to the source chip platform bandwidth. Then, it calculates a new batch size adapted to the target chip platform bandwidth, ensuring the value is not less than 1, based on the batch size configured for the source chip platform. Next, it compares the working set of the source chip platform memory with the on-chip SRAM capacity of the target chip platform. If the original working set exceeds the target chip platform's SRAM limit, it rounds up to obtain a tensor block factor. This factor is used to add block processing logic to the input tensor, ultimately outputting the adjusted batch size. With tensor block factor This enables test case memory configuration to adapt to the bandwidth and on-chip storage constraints of the target chip platform.

[0118]

[0119] / / Adjust batch size to fit target memory bandwidth

[0120]

[0121] / / Adjust working set size to fit target SRAM

[0122]

[0123] / / Perform additional block division on the input tensor

[0124] Figure 3 A flowchart illustrating the verification of target test cases provided in an exemplary embodiment of this application is shown, the method being performed by a terminal device, client, or server. Based on Figure 1 In the embodiment shown, steps 310 to 320 are included after step 150.

[0125] Step 310: Perform syntax verification, semantic verification, and execution verification on the migrated target test cases respectively.

[0126] Syntax verification is used to check whether the target test case after migration can be correctly parsed by the compiler in the target chip platform. Semantic verification is used to check whether the data flow and control flow of the computation graph in the target test case are legal on the target chip platform after the syntax verification passes. Execution verification is used to verify whether the difference between the output value obtained by the target test case running on the target chip platform or simulator and the preset expected output value in the test case to be migrated is less than the preset difference threshold.

[0127] In this embodiment, after migrating the adjusted target test cases to the target chip platform, three layers of verification are performed on the migrated target test cases: syntax verification, semantic verification, and execution verification. Syntax verification, as the first layer, checks whether the syntax specification of the target test cases matches the target chip compiler standard and determines whether the file can be read and parsed correctly by the compiler. After passing syntax verification, semantic verification is performed on the target test cases. Semantic verification checks whether the data flow and control flow logic of the computation graph in the target test cases conforms to the hardware operating constraints of the target chip platform. After semantic verification, execution verification is performed on the target test cases. The target test cases are deployed to the target chip platform hardware or a matching simulator for actual execution. The difference between the actual output value and the expected output value is compared. If the difference is less than a preset difference threshold, the execution verification result is determined to be successful.

[0128] In some embodiments, when performing syntax verification on target test cases, the syntax of tensor dimension declarations and the writing format of various operator-specific keywords within the target test cases are first checked against the syntax specifications of the target chip platform compiler to ensure they conform to the standards. Simultaneously, the text content is scanned to check for illegal characters that the compiler cannot recognize, missing required configuration parameters in operator definitions, and other formatting issues. For example, missing separators in tensor dimension writing, misspelled operator names, the presence of special garbled characters, and the absence of the required shape parameter for operators all constitute syntax violations. If any of these formatting errors occur in the target test case, the syntax verification result for that target test case will fail.

[0129] In some embodiments, when performing semantic verification on target test cases, the first step is to examine the computation graph within the test case, verifying the data flow of traversing the computation graph and checking that the dimension indices and block intervals when operators read and write tensors do not exceed the actual storage range of the tensors. This is to prevent illegal memory access behaviors such as reading invalid data or mistakenly overwriting valid data. Then, the execution dependencies between operators are examined and analyzed to check for any operator combinations that the target chip platform does not support for serial or parallel execution. For example, if the target chip platform hardware prohibits the direct connection between the output of operator A and the input of operator B, such a dependency chain is considered a violation. If any of the above-mentioned violations in data flow or operator dependency logic occur within the computation graph, the semantic verification result of the target test case will fail.

[0130] In some embodiments, when performing execution verification on the target test case, the migrated target test case is first deployed to the target chip platform hardware or a matching simulation simulator for full execution to obtain the tensor results output after computation. Subsequently, the error difference between the output tensor value and the standard reference tensor value is calculated, and this difference is compared with a preset difference threshold for verification. For example, if the tensor output difference is less than the preset difference threshold, it means that the accuracy of the calculation result meets the platform requirements, and the execution verification of the target test case is determined to be successful; if the difference exceeds the preset threshold, it is determined that the computation result after migration is distorted, and the execution verification of the target test case is determined to be unsuccessful.

[0131] Step 320: Determine the transfer result based on the syntax validation result, semantic validation result, and execution validation result.

[0132] In this embodiment of the application, when determining the overall migration result of the target test case, it is necessary to make a judgment by comprehensively considering the syntax verification result, semantic verification result, and execution verification result.

[0133] In one optional implementation, if syntax validation, semantic validation, and execution validation all pass, the migration result is determined to be successful. If syntax validation and semantic validation pass but execution validation fails, the migration result is determined to be pending manual review. If syntax validation fails but passes after automatic repair, and syntax validation, semantic validation, and execution validation all pass, the migration result is determined to be automatically repaired. If semantic validation fails, the migration result is determined to be unmigratable.

[0134] In this implementation, when determining the final migration status of the target test case based on the comprehensive three-layer verification results, four categories of result determination rules are established according to different verification combinations: Category 1: All three layers of verification—syntax verification, semantic verification, and execution verification—pass, indicating that the target test case can be parsed normally on the target chip platform, its logic is legal, and its computational accuracy meets the standards; the migration result is directly determined as successful. Category 2: Syntax verification and semantic verification pass, but the execution verification output error exceeds a preset threshold, indicating that there are no hardware compatibility issues between the code format and the computational logic, only a deviation in numerical accuracy; the migration result is determined as pending manual review, and the cause of the accuracy anomaly is to be manually investigated. Category 3: Initial syntax verification fails, but after the system automatically corrects the syntax error, it passes the syntax verification again, and subsequent semantic and execution verifications show no anomalies; this indicates that only a format problem that can be automatically corrected exists; the migration result is determined as automatically corrected. Category 4: If semantic verification fails, it means that the computation graph data flow and operator dependency logic in the target test case have underlying defects that are incompatible with the target chip platform hardware and cannot be automatically adapted and repaired; the migration result is directly determined as unmigrateable.

[0135] The solution in this application involves performing three levels of verification—syntax, semantics, and execution—on the migrated target test cases. First, syntax verification screens for compilation and parsing issues such as file format, keywords, and parameters, proactively intercepting illegal test cases that cannot be recognized by the target chip platform's compiler. Next, semantic verification checks the compatibility of the computation graph's data flow and control flow with the hardware's operating rules, proactively identifying underlying logic defects such as hardware-incompatible operator dependencies and illegal memory accesses. Finally, execution verification compares the output errors through real-device or simulation runs, precisely quantifying whether the numerical accuracy meets the standards. Simultaneously, based on different combinations of the three-level verification results, four standardized migration conclusions are categorized: successful migration, awaiting manual review, automatic repair, and non-migration. This not only allows for layered identification of the root causes of faults in different dimensions—format, logic, and accuracy—during the cross-platform migration of test cases, distinguishing between scenarios that can be automatically repaired, require manual intervention, and are completely incompatible, reducing manual debugging workload, but also ensures that the final delivered target test cases meet the triple requirements of compiler parsing, hardware logic legality, and computational accuracy compliance, improving the reliability and standardized management capabilities of cross-chip platform test case migration.

[0136] Figure 4 A flowchart illustrating a proposed test case retest, provided in an exemplary embodiment of this application, is shown. This method is executed by a terminal device, client, or server. Based on Figure 1 In the embodiment shown, steps 410 to 490 are included after step 150.

[0137] Step 410: Compare the operators contained in the migrated target test cases with the operators contained in the target chip platform to determine the operator coverage of the target chip platform.

[0138] In this implementation, the complete set of operators within the target test case after migration is first extracted. This set of operators is then compared and matched one by one with the set of operators natively supported by the target chip platform. The number of operators in the target chip platform that can be covered by the target test case is counted. This number of covered operators is divided by the total number of operators supported by the target chip platform itself; the ratio of the two is the operator coverage rate. This operator coverage rate can intuitively measure the completeness of the target test case's coverage of the target chip platform's operator capabilities. It can quickly identify operators in the target chip platform that are not covered by the target test case, and help evaluate whether the existing test cases can fully verify the chip's full operator hardware capabilities.

[0139] Step 420: Compare the tensor shapes contained in the migrated target test cases with the tensor shapes contained in the target chip platform to determine the tensor shape coverage of the target chip platform.

[0140] In this implementation, firstly, the complete set of tensor shapes appearing in all target test cases after migration is extracted. This set is then compared one by one with the complete set of legal tensor shapes natively allowed and operable by the target chip platform hardware. The number of tensor shapes supported by the target chip platform that are covered by the test cases is counted. This number is divided by the total number of legal tensor shapes on the target chip platform; the resulting ratio is the tensor shape coverage rate. This tensor shape coverage rate provides a direct measure of the completeness of the existing migration test cases' coverage of various tensor shapes on the target chip platform, quickly locating tensor shapes supported by the chip but not covered by the test cases, and assessing whether the current test cases can adequately verify the chip's various tensor segmentation and memory access adaptation capabilities.

[0141] Step 430: Compare the data types contained in the migrated target test cases with the data types contained in the target chip platform to determine the data type coverage of the target chip platform.

[0142] In this implementation, firstly, the set of all data types used in all target test cases after migration is completed is extracted. This set is then compared and matched one by one with the complete set of data types natively supported by the target chip platform hardware. The number of data types supported by the target chip platform that are covered by the test cases is counted. This coverage number is divided by the total number of all natively supported data types of the target chip platform; the resulting ratio is the data type coverage rate. This data type coverage rate provides a direct measure of the completeness of the existing migration test cases' coverage of various precision specifications of the target chip platform. It quickly identifies data types supported by the chip but not covered by the test cases, and assesses whether the current test cases can fully verify the chip's computational and storage adaptation capabilities under different numerical precisions.

[0143] Step 440: Compare the boundaries contained in the migrated target test cases with the boundaries contained in the target chip platform to determine the boundary coverage of the target chip platform.

[0144] The boundaries mentioned above refer to the critical extreme value conditions of various parameters. Specifically, the boundaries included in the migrated target test cases refer to the actual extreme operating condition parameters related to tensors, storage, operations, values, and memory access generated during the actual configuration and operation of the target test cases. The boundaries included in the target chip platform refer to the upper and lower limits of all dimensions of parameters (tensors, operators, storage, input / output, and memory access) and special critical constraints defined by the hardware rules of the target chip platform.

[0145] For example, tensor boundaries include one or more of the following: minimum / maximum tensor dimension, upper limit of the number of dimensions, and maximum length of a single dimension; storage boundaries include one or more of the following: maximum SRAM / on-chip cache capacity and extreme values ​​of tensors that can be loaded at one time; computational boundaries include one or more of the following: maximum parallel computation of a single operator and maximum / minimum values ​​of a batch; data boundaries include one or more of the following: numerical extreme values ​​of various data types and precision critical intervals; hardware memory access boundaries include one or more of the following: the limit of data transfer in a single access to hardware memory, the extreme value of a single block read / write, and the critical value of memory access address alignment.

[0146] In this implementation, firstly, the sets of various parameter boundaries appearing in all target test cases after migration are extracted. These sets are then compared and matched one by one with the complete set of legal parameter boundaries defined by the target chip platform hardware. The number of boundaries supported by the target chip platform that are covered by the target test cases is counted. This number of covered boundaries is divided by the total number of all native parameter boundaries of the target chip platform, and the resulting ratio is the boundary coverage rate. This boundary coverage rate can intuitively measure the completeness of the existing migration test cases in covering various extreme boundary scenarios of the target chip platform. It can quickly locate extreme parameter scenarios supported by the target chip platform but not covered by the target test cases, and evaluate whether the current target test cases can fully verify the operational stability and adaptability of the target chip platform under various critical extreme conditions such as tensor size, batch size, SRAM load, and memory access bandwidth.

[0147] Step 450: The difference between the expected operator coverage and the operator coverage of the target chip platform is determined as the operator coverage gap.

[0148] The aforementioned expected operator coverage refers to a pre-set threshold for operator coverage defined for the target chip platform. It is used to measure whether the coverage of the target test cases for the operators of the target chip platform meets the test specification requirements.

[0149] In this implementation, the difference between the expected operator coverage and the actual calculated operator coverage of the target chip platform is calculated to obtain the operator coverage gap. If the actual operator coverage of the target chip platform is greater than or equal to the expected operator coverage, it means that the current migrated target test cases have reached the preset standard of operator coverage of the target chip platform, and the operator verification scenarios are sufficient. If the actual operator coverage of the target chip platform is less than the expected operator coverage, it means that the current migrated target test cases are missing a large number of target chip platform operator test scenarios, and corresponding test cases need to be added to fill the operator coverage gap.

[0150] Step 460: The difference between the desired tensor shape coverage and the tensor shape coverage of the target chip platform is defined as the tensor shape coverage gap.

[0151] The aforementioned expected tensor shape coverage refers to a pre-set threshold for tensor shape coverage defined for the target chip platform. It is used to measure whether the coverage of various legal tensor shapes of the target chip platform by the target test cases meets the test specification requirements.

[0152] In this implementation, the difference between the expected tensor shape coverage and the actual calculated target chip platform tensor shape coverage is calculated to obtain the tensor shape coverage gap. If the actual target chip platform tensor shape coverage is greater than or equal to the expected tensor shape coverage, it means that the current migrated target test cases meet the preset standard for tensor shape coverage of the target chip platform, and the tensor specification verification scenarios are sufficient. If the actual target chip platform tensor shape coverage is less than the expected tensor shape coverage, it indicates that the current migrated target test cases are missing a large number of target chip platform tensor shape test scenarios, and corresponding test cases need to be added to fill the tensor shape coverage gap.

[0153] Step 470: The difference between the expected data type coverage and the data type coverage of the target chip platform is determined as the data type coverage gap.

[0154] The aforementioned expected data type coverage rate refers to the pre-set data type coverage threshold defined for the target chip platform, which is used to measure whether the coverage of the target test cases for each supported data type of the target chip platform meets the test specification requirements.

[0155] In this implementation, the difference between the expected data type coverage and the actual calculated target chip platform data type coverage is calculated to obtain the data type coverage gap. If the actual target chip platform data type coverage is greater than or equal to the expected data type coverage, it means that the current migrated target test cases cover the target chip platform data types to a preset standard, and the data type verification scenarios are sufficient. If the actual target chip platform data type coverage is less than the expected data type coverage, it means that the current migrated target test cases are missing a large number of target chip platform data type test scenarios, and corresponding test cases need to be added to fill the data type coverage gap.

[0156] Step 480: The difference between the expected boundary coverage and the boundary coverage of the target chip platform is determined as the boundary coverage gap.

[0157] The aforementioned expected boundary coverage rate refers to the pre-set boundary coverage threshold for the target chip platform, which is used to measure whether the coverage of various hardware critical boundary conditions of the target chip platform by the target test cases meets the test specification requirements.

[0158] In this implementation, the difference between the expected boundary coverage rate and the actual calculated target chip platform boundary coverage rate is calculated to obtain the boundary coverage gap. If the actual target chip platform boundary coverage rate is greater than or equal to the expected boundary coverage rate, it means that the current migrated target test cases have reached the preset standard in terms of coverage of the target chip platform hardware boundary, and the extreme operating condition verification scenarios are sufficient. If the actual target chip platform boundary coverage rate is less than the expected boundary coverage rate, it means that the current migrated target test cases are missing a large number of target chip platform hardware boundary test scenarios, and corresponding test cases need to be added to fill the boundary coverage gap.

[0159] Step 490: Generate test case supplementation suggestions based on the uncovered operators, tensor shapes, data types, and boundaries in the target chip platform.

[0160] In this implementation, four types of constraints—operators, tensor shapes, data types, and hardware boundaries—are first identified that are supported by the target chip platform but not covered by the existing target test cases after migration. Based on these missing items, targeted supplementary test suggestions are generated to guide the addition of new supporting test cases, fill the test gaps for various hardware specifications and extreme operating conditions, improve the overall coverage, and enable the actual test coverage to reach the preset target coverage standard.

[0161] Below, with reference to Table 3, we will provide an exemplary explanation of the above-mentioned test case supplementation suggestions generated based on the uncovered operators, tensor shapes, data types, and boundaries in the target chip platform.

[0162]

[0163] As shown in Table 3, the operators not covered in the target chip platform include LayerNorm and Pow; the tensor shapes not covered in the target chip platform include (8,1,128,128) and (2048); the data types not covered in the target chip platform include INT8 and UINT8; the boundaries not covered in the target chip platform include a maximum single-dimensional length of 2048, a full-load boundary of on-chip cache, and a maximum of 8 input tensors. To address the aforementioned uncovered situations, the following test case supplementation suggestions are generated: For operators, add independent test cases containing only LayerNorm and only Pow operators, and use them with regular input tensors to complete basic functional verification; For tensor shapes, add test cases configuring tensor specifications (8, 1, 128, 128) and one-dimensional tensors (2048) respectively to verify the compatibility of the target chip platform with this type of dimensional structure in compilation and operation; For data types, based on the existing Conv2d and MatMul operators, add INT8 and UINT8 quantized version test cases to verify the output accuracy of low-precision data operations; For boundaries, construct tensor test cases with a single-dimensional size equal to 2048, configure multiple tensors to make the on-chip cache reach the full load threshold, and configure extreme operating condition test cases with 8-way input tensors to verify the operational stability of the chip under critical parameters.

[0164] The solution in this application compares the operators, tensor shapes, data types, and boundaries of the migrated target test cases with those of the target chip platform. Four types of actual target chip platform coverage are calculated, and the coverage gaps are solved by combining the preset target coverage for each dimension. Finally, supplementary testing suggestions are generated based on the various hardware constraints of the target chip platform that are not covered. This allows for hierarchical quantification of the completeness of existing test cases in verifying the full range of hardware specifications and extreme conditions of the target chip platform. It intuitively identifies coverage gaps in each dimension and quantifies the magnitude of these gaps, accurately locates unverified operators, tensor shapes, data types, and boundary scenarios, and outputs targeted supplementary testing solutions. This comprehensively fills in the testing blind spots, effectively improves the sufficiency of test cases in covering the hardware capabilities of the target chip platform, ensures that the functional and stability verification of the chip under various operational specifications and extreme parameters is complete, and reduces the risk of operational anomalies caused by uncovered scenarios after hardware deployment.

[0165] Figure 5 A flowchart illustrating the method for determining test cases to be migrated, as provided in an exemplary embodiment of this application, is shown. This method is performed by a terminal device, client, or server. Based on Figure 1 In the embodiment shown, step 110 is implemented by steps 510 to 530.

[0166] Step 510: Obtain the hardware characteristics of the source chip platform and the target chip platform.

[0167] In this embodiment, the inherent hardware attributes of the source chip platform and the target chip platform are obtained, including their respective supported operator sets, tensor shapes, data types, storage and computational critical boundaries, hardware machine precision, computational execution paths, and other specifications.

[0168] An alternative implementation involves obtaining the hardware feature vector of the source chip platform in terms of multi-dimensional hardware features. And the hardware feature vectors of the target chip platform in multi-dimensional hardware features. .

[0169] The multidimensional hardware features include at least two of the following: computing unit type, systolic array size, on-chip static random access memory capacity, number of high-bandwidth memory levels, memory bandwidth, set of supported data types, parallel model, maximum tensor dimension, supported fusion operators, and supported sparse computation.

[0170] In this implementation, a hardware feature vector covering multiple key dimensions is constructed to comprehensively characterize the hardware capabilities of the source chip platform and the target chip platform from multiple perspectives. This can quantify the hardware differences between the two platforms in a three-dimensional and complete manner, avoid the one-sidedness caused by single-dimensional evaluation, and improve the accuracy of hardware similarity calculation results.

[0171] Below, with reference to Table 4, we will provide an exemplary illustration of the hardware feature vectors of the source chip platform and the target chip platform in terms of multidimensional hardware characteristics.

[0172]

[0173] For example, the hardware feature vector of the source chip platform in multi-dimensional hardware features is obtained. And obtain the hardware feature vector of the target chip platform in multi-dimensional hardware features. Among them, hardware feature vectors and Each feature includes 10 dimensions of hardware characteristics. As shown in Table 4, these 10 hardware characteristics, from left to right, are: computational unit type, systolic array size, on-chip SRAM capacity, number of HBM levels, memory bandwidth, supported data type set, parallel model, maximum tensor dimension, supported fusion operators, and supported sparse computation. Table 4 also provides examples of values ​​and encoding methods for each hardware characteristic.

[0174] Step 520: Determine the hardware similarity between the source chip platform and the target chip platform based on the hardware characteristics of the source chip platform and the target chip platform.

[0175] In this implementation, the hardware characteristics of the source chip platform and the target chip platform are obtained, and the hardware similarity between the source chip platform and the target chip platform is quantitatively calculated. This can objectively quantify the hardware differences between the two chip platforms, select test cases based on the degree of difference, maximize the reuse of existing test resources, reduce the workload of adaptation and modification, avoid blind migration and ineffective investment, and improve the efficiency of cross-platform migration of test cases.

[0176] In one optional implementation, the weighted similarity between the hardware feature vectors of the source chip platform and the target chip platform is calculated to obtain the hardware similarity between the source chip platform and the target chip platform.

[0177] In this embodiment, the weighted similarity between the hardware feature vectors of the source chip platform and the target chip platform can be calculated using Formula 2.

[0178] Formula 2 in, The weights of the i-th dimension hardware features satisfy... , This represents the total number of dimensions of the hardware feature vectors. Let be the similarity function of the source chip platform and the target chip platform in the i-th dimension of the hardware feature. Where, when the hardware feature value type is numerical, When the value type of a hardware feature is a set, When the value type of the hardware feature is category, .

[0179] In this implementation, a weighted similarity is calculated between the source and target chip platform hardware feature vectors to obtain the hardware similarity between the two chip platforms. This allows for the configuration of differentiated weights based on the impact of various hardware features on chip operation and test case migration. It distinguishes the contributions of core and secondary hardware features in the hardware similarity calculation, avoiding evaluation bias caused by equal weighting of all hardware features. This enables a quantitative and refined evaluation of the degree of hardware differences between the two chip platforms, ensuring that the obtained hardware similarity results align with the actual business needs of cross-platform test case migration. This provides a reliable and objective quantitative basis for subsequent differentiated selection of test cases to be migrated and the formulation of hierarchical migration strategies, improving the rationality and accuracy of test case migration plan decisions.

[0180] In one alternative implementation, the computational unit type, the set of supported data types, the parallel model, the systolic array size, the memory bandwidth, the on-chip static random access memory capacity, the supported fusion operators, the number of high-bandwidth memory levels, the maximum tensor dimension, and the hardware feature weights of supported sparse computation decrease sequentially.

[0181] For example, the hardware feature weights for computation unit type, supported data type set, parallel model, systolic array size, memory bandwidth, on-chip static random access memory capacity, supported fusion operators, number of high-bandwidth memory levels, maximum tensor dimension, and supported sparse computation are 0.20, 0.18, 0.15, 0.12, 0.10, 0.08, 0.07, 0.04, 0.03, and 0.03, respectively.

[0182] In this implementation, based on the degree of impact on cross-platform migration of test cases, and in descending order of the order of computing unit type, supported data type set, parallel model, systolic array size, memory bandwidth, on-chip static random access memory capacity, supported fusion operators, number of high-bandwidth memory levels, maximum tensor dimension, and supported sparse computation, weighted similarity calculation is performed on hardware features. This prioritizes core hardware features that play a decisive role in operator execution and tensor operations, while weakening secondary hardware features with a lower degree of impact. This makes the hardware similarity calculation results more closely match the underlying constraints of chip operation and accurately reflect the true adaptation differences between the source chip platform and the target chip platform.

[0183] Step 530: Based on hardware similarity, identify the test cases to be migrated from the test cases of the source chip platform.

[0184] In some embodiments, the hardware similarity between the source chip platform and the target chip platform is used as the criterion to select test cases that are compatible with the hardware specifications of the target chip platform and whose modification workload is controllable from the existing test cases of the source chip platform as test cases to be migrated.

[0185] In this implementation, the higher the hardware similarity, the higher the overlap between the source chip platform and the target chip platform in operators, tensors, data types, and boundary rules, and the more test cases can be directly reused. When the hardware similarity is low, only a small number of test cases with high hardware feature matching are selected for migration, and test cases with hardware conflicts and extremely high modification difficulty are discarded, thereby reducing the workload of cross-platform test case adaptation and reconstruction.

[0186] In one optional implementation, if the hardware similarity is greater than or equal to a first similarity threshold, all test cases in the source chip platform are identified as test cases to be migrated. If the hardware similarity is less than the first similarity threshold but greater than or equal to a second similarity threshold, a subset of test cases from the source chip platform are selected as test cases to be migrated. If the hardware similarity is less than the second similarity threshold but greater than or equal to a third similarity threshold, the test cases corresponding to the atomic operators in the source chip platform are identified as test cases to be migrated. If the hardware similarity is less than the third similarity threshold, the source chip platform is replaced or test cases are built from scratch for the target chip platform. The values ​​of the first, second, and third similarity thresholds decrease sequentially.

[0187] In one optional implementation, when the hardware similarity is less than a first similarity threshold and greater than or equal to a second similarity threshold, a subset of test cases are selected from the source chip platform and identified as test cases to be migrated. The specific selection method is as follows: First, for each test case, it is checked whether the test case meets the following four conditions; if any condition is not met, the test case is transferred to manual review or directly determined as unmigratable. When all four conditions are met, the test case is directly identified as a preliminary selection test case; then, each preliminary selection test case is scored and ranked according to the target chip platform compatibility, the added coverage value after migration, and the migration workload; finally, a predetermined number of the top-ranked preliminary selection test cases are selected based on actual needs and identified as test cases to be migrated.

[0188] Among them, the conditions are as follows: Condition 1: The operators contained in the test cases have exact mappings, approximate mappings, or verifiable equivalent subgraphs; Condition 2: The data type, tensor shape, layout (including data storage arrangement, hardware block layout, and memory access layout) and resource requirements meet the constraints of the target chip platform; Condition 3: The migration retains the verification judgment conditions and verification objectives of the test cases; Condition 4: There are reliable reference results or differential verification methods.

[0189] In this implementation, when the hardware similarity is less than the first similarity threshold and greater than or equal to the second similarity threshold, the first round of screening is completed based on four conditions. Test cases that do not meet any one of the conditions are transferred to manual review or directly removed without further consideration for migration. Test cases that meet all four conditions are then selected based on a comprehensive score considering target chip compatibility, operator coverage gain, and implementation cost. This approach not only removes obviously incompatible test cases in advance and reduces invalid processing, but also prioritizes test cases with better migration cost-effectiveness, maximizing the expansion of the target chip platform's test coverage within a controllable workload.

[0190] The migration recommendations based on hardware similarity are illustrated below with reference to Table 5. These recommendations include migration priority, expected migration success rate, and migration strategy.

[0191]

[0192] As shown in Table 5, the hardware similarity S between the source chip platform and the target chip platform is divided into four intervals and matched with corresponding migration schemes: When S≥0.8, the migration priority is high, the expected migration success rate is higher than 90%, and a full migration with a high degree of automation is adopted; when 0.6≤S<0.8, the migration priority is medium, the expected migration success rate is in the range of 60%~90%, and selective migration is performed with the assistance of manual review; when 0.4≤S<0.6, the migration priority is low, the expected migration success rate is 30%~60%, and only atomic operator test cases are migrated; when S<0.4, it is not recommended to carry out migration work, the expected migration success rate is lower than 30%, and it is recommended to build test cases from scratch for the target chip platform or replace the source chip platform with an adapted one.

[0193] The test case migration method provided in this application embodiment will be illustrated below with reference to Table 6 and a specific example.

[0194]

[0195] As shown in Table 6, the hardware feature vectors of the source chip platform Pulsating array Data Stream and the hardware feature vector of the target chip platform. Pulsating array Data flow, The similarity of hardware features between the source chip platform and the target chip platform in each dimension was calculated and weighted, resulting in a hardware similarity of 0.70 between the source chip platform and the target chip platform. This is considered a medium priority, and selective migration test cases were used, supplemented by manual review.

[0196] In the above implementation, based on the hardware similarity calculated between the source chip platform and the target chip platform, if the hardware similarity between the source chip platform and the target chip platform is greater than or equal to the first similarity threshold, all test cases of the source chip platform are directly used as test cases to be migrated, maximizing the reuse of existing test assets, eliminating the test case screening process, and quickly building the basic test system of the target chip platform; if the hardware similarity is less than the first similarity threshold but greater than or equal to the second similarity threshold, only a portion of test cases with high hardware feature matching degree, small modification workload, and high coverage value are selected from the source chip platform for migration, reducing test cases with high adaptation costs while retaining core verification capabilities; if the hardware similarity is less than the second similarity threshold but greater than or equal to the third similarity threshold, only the basic test cases corresponding to atomic operators in the source chip platform are selected for migration, prioritizing the verification of the underlying basic operations of the target chip platform and avoiding large-scale reconstruction work caused by complex combination scenarios; if the hardware similarity is less than the third similarity threshold, the adapted source chip platform is replaced or test cases are built from scratch for the target chip platform, avoiding unnecessary investment such as repeated adaptation and test failure caused by forced migration when the underlying hardware differences between the two platforms are too large.

[0197] The solution in this application uses hardware similarity and a three-level similarity threshold to quantify and distinguish the degree of hardware differences between the source chip platform and the target chip platform. It matches a gradient migration scheme, balances the efficiency of test case reuse, the manpower cost of cross-platform adaptation and the verification integrity of the target chip platform, shortens the test system migration and implementation cycle, and reduces the problems of verification misjudgment and test case reconstruction rework caused by hardware incompatibility.

[0198] In some embodiments, test cases are migrated and reused simultaneously from multiple source chip platforms for the target chip platform. Specifically, the hardware similarity between the target chip platform and each source chip platform is calculated, and the constraint mapping relationships corresponding to each source chip platform are merged and deduplicated. When test cases conflict, the test cases are migrated from the source chip platform with the highest hardware similarity to the target chip platform first. Test case conflict refers to a situation where two test cases from different source chip platforms, targeting the same operator / test scenario, cannot be directly reused simultaneously and require adaptive adjustments using constraint mapping relationships. In such cases, migration is only possible from the source chip platform with the highest hardware similarity to the target chip platform to ensure that the selected test cases better fit the hardware characteristics of the target chip platform and improve the migration success rate. After migration, joint coverage analysis is performed, and the coverage of the target chip platform across various dimensions is calculated by integrating the test cases migrated and reused from multiple source chip platforms. Compared to single-source platform migration, the multi-source chip platform joint migration approach effectively expands the scope of reusable test scenarios. Operators, tensor shapes, data types, and boundary coverage can all be significantly improved. At the same time, it greatly reduces the number of additional test cases that need to be built, thus reducing the workload of building the target chip platform test system.

[0199] In some embodiments, when new test cases are released on the source chip platform, only the new test cases are parsed, adjusted, and migrated to obtain the new target test cases, thus maintaining the continuous updating of the test system.

[0200] Figure 6 An architectural block diagram of a test case migration system provided in an exemplary embodiment of this application is shown. The test case migration system 600 includes a test case filtering module 601, an acquisition module 602, a parsing module 603, an adjustment module 604, a migration module 605, a verification module 606, and a coverage analysis module 607.

[0201] The hardware characteristics of the source chip platform and the target chip platform are input into the test case filtering module 601. This module calculates the hardware similarity between the source and target chip platforms and determines the test cases to be migrated from the test cases of the source chip platform based on the similarity score. The acquisition module 602 obtains the constraint mapping relationship between the source and target chip platforms based on their hardware characteristics. The parsing module 603 parses the test cases to be migrated to obtain the first test case element contained within them. Based on this constraint mapping relationship, the adjustment module 604 adjusts the first test case element according to the constraint mapping relationship, obtaining the second test case element. The test cases to be migrated containing the second test case element are the target test cases.

[0202] Figure 7 A flowchart illustrating the adjustment and migration of test cases according to an exemplary embodiment of this application is shown. Figure 7 As shown, the test cases to be migrated are processed sequentially as follows: structural parsing, operator replacement, tensor shape adjustment, data type adjustment, tolerance threshold adjustment, memory resource configuration adjustment, and invalid operator cleanup are performed on the test cases. After all processing is complete, the target test cases are obtained. Subsequently, the migration module 605 is used to migrate the target test cases to the target chip platform. The verification module 606 performs validity verification on the migrated target test cases on the target chip platform, including one or more of syntax verification, semantic verification, and execution verification. Simultaneously, the coverage analysis module 607 analyzes the coverage of the migrated target test cases on the target chip platform in four dimensions: operators, tensor shape, data type, and boundaries, and generates a coverage report and supplementary test suggestions for the target chip platform. The coverage report clearly identifies which aspects of the target chip platform (operators, tensor shape, data type, and boundaries) are covered and which are not after the test case migration, transforming the supplementary test case work from "guessing based on experience" to "data-driven targeted completion," significantly improving the completeness of the test cases. Throughout the entire test case migration process, the inputs and outputs of each module are clearly defined, and the migration process is auditable and traceable. Different engineers performed test case migrations on the same source chip platform at different times and obtained consistent results.

[0203] Regarding the test case construction cycle, traditional solutions typically take 6-12 months, while the test case migration method provided in this application only requires 1-2 months, directly shortening the cycle by 80%-85%. In terms of initial operator coverage, traditional solutions build from scratch with 0% initial operator coverage, while the test case migration method provided in this application achieves 75%-90% initial operator coverage after migration. In other words, in traditional solutions, test cases adapted to the target chip platform are manually written one by one from scratch, initially with no usable test cases and no corresponding verification cases for various chip operators, resulting in 0% operator test coverage—all operators are untested. Using the test case migration method provided in this application, a large number of existing test cases from mature source chip platforms are directly reused. After automated adaptation and adjustment, 75%-90% of the operators in the target chip platform can have corresponding test cases in the initial stage, eliminating the need for manual development from scratch. Test coverage of most operators is completed upon deployment, requiring only targeted supplementation of the remaining few uncovered operators. In terms of personnel input, traditional solutions typically require 8-12 engineers per month, while this application only requires 2-3 person-months, reducing personnel input by 70%-75%. For target chip platforms with high hardware similarity to the source chip platform, the test case migration method provided in this application can achieve a migration success rate of up to 90%. Regarding coverage blind spot identification, traditional solutions rely entirely on manual experience, while the test case migration method provided in this application can achieve 100% automated identification of coverage blind spots.

[0204] It should be noted that the method steps in the above embodiments can be arbitrarily combined to obtain new embodiments, and this application does not impose any restrictions on them.

[0205] Figure 8 This invention illustrates a structural block diagram of a test case migration apparatus 800 provided in an exemplary embodiment of this application. The test case migration apparatus 800 includes: The test case filtering module 601 is used to determine the test cases to be migrated from the test cases of the source chip platform; The acquisition module 602 is used to acquire constraint mapping relationships, which are used to indicate the constraint relationships between the source chip platform and the target chip platform on use case elements. Different types of use case elements correspond to different constraint mapping relationships. The parsing module 603 is used to parse the test cases to be migrated to obtain the first test case elements contained in the test cases to be migrated; The adjustment module 604 is used to adjust the first test case element according to the constraint mapping relationship corresponding to the first test case element to obtain the second test case element; the test case to be migrated containing the second test case element is the target test case; Migration module 605 is used to migrate the target test cases to the target chip platform.

[0206] In some embodiments, the first use case element includes: use case attribute information; The adjustment module 604 is specifically used for: Determine the constraint relationship of the use case attribute information included in the constraint mapping relationship corresponding to the first use case element; The first use case element is adjusted based on the constraint relationship of the use case attribute information to obtain the second use case element.

[0207] In some embodiments, the type of the use case element includes an operator; the first use case element includes a first operator corresponding to the source chip platform; the second use case element includes a second operator corresponding to the target chip platform; the first operator is obtained by parsing the test case to be migrated; the use case attribute information includes operator parameters, and the constraint relationship of the use case attribute information includes: when mapping the first operator to the second operator, the intermediate operator corresponding to the first operator and the method of adjusting the operator parameters of the intermediate operator; The adjustment module 604 is specifically used for: Replace the first operator with the intermediate operator; According to the operator parameter adjustment method, the operator parameters of the intermediate operator are adjusted to obtain the second operator.

[0208] In some embodiments, the operator parameter adjustment method includes one or more of the following: rearranging dimension labels, mapping after conversion according to fill format, mapping after splitting according to reduction operator type, and no mapping.

[0209] In some embodiments, the type of the use case element includes a tensor shape; the first use case element includes a first tensor shape corresponding to the source chip platform; the second use case element includes a second tensor shape corresponding to the target chip platform; the first tensor shape is obtained by parsing the test case to be migrated; the use case attribute information includes a target tile of the tensor shape, and the constraint relationship of the use case attribute information includes an alignment requirement for tensor shape alignment based on the target tile when mapping the first tensor shape to the second tensor shape, the alignment requirement including upward alignment to an integer multiple of the target tile; The adjustment module 604 is specifically used for: The first tensor shape is aligned upwards to an integer multiple of the target tile to obtain the second tensor shape.

[0210] In some embodiments, the type of the use case element includes a data type; the first use case element includes a first data type corresponding to the source chip platform; the second use case element includes a second data type corresponding to the target chip platform; the first data type is obtained by parsing the test case to be migrated; the use case attribute information includes the tolerance of the data type, and the constraint relationship of the use case attribute information includes: when the first data type is mapped to the second data type, the third data type corresponding to the first data type and the tolerance adjustment method for the third data type; The adjustment module 604 is specifically used for: Replace the first data type with the third data type; According to the tolerance adjustment method, the third data type is adjusted to obtain the second data type.

[0211] In some embodiments, the tolerance adjustment method includes one or more of the following: one-to-one replacement with no change in tolerance, precision conversion with tolerance reduction, format conversion with dynamic tolerance adjustment, and downgrade mapping with recalibration of parameters.

[0212] In some embodiments, the type of the use case element includes memory resources; the first use case element includes a first memory resource corresponding to the source chip platform; the second use case element includes a second memory resource corresponding to the target chip platform; the first memory resource is obtained by parsing the test case to be migrated; the use case attribute information includes batch size and / or tensor block size, and the constraint relationship of the use case attribute information includes: when mapping the first memory resource to the second memory resource, the batch size adjustment method and / or tensor block size adjustment method corresponding to the first memory resource; The adjustment module 604 is specifically used for: According to the batch size adjustment method, the batch size on the first memory resource is adjusted, and the adjusted batch size is greater than or equal to 1; and / or, According to the tensor block size adjustment method, the tensor block size on the first memory resource is adjusted to obtain the second memory resource.

[0213] In some embodiments, the adjustment module 604 is specifically used for: For each third operator included in the test case to be migrated, if there is no third operator and its corresponding substitute operator in the target chip platform, the third operator and its corresponding subgraph are deleted from the computation graph of the test case to be migrated. The third operator is any one of the operators included in the test case to be migrated.

[0214] In some embodiments, the adjustment module 604 is further configured to: Search the equivalent computation graph database for candidate alternative subgraphs composed of operators supported by the target chip platform, the candidate alternative subgraphs being used to equivalently implement the computational function of the third operator; The candidate alternative subgraph is subjected to at least one verification, which includes one or more of the following: shape consistency verification, data type validity verification, sampling numerical equivalence verification, and computational envelope verification. If all at least one verification passes, the third operator in the test case is replaced with the candidate alternative subgraph; If the candidate alternative subgraph is not found in the equivalent computation graph database, or if at least one verification fails, the step of deleting the third operator and the subgraph corresponding to the third operator from the test case is performed, or the third operator is marked as non-transferable.

[0215] In some embodiments, the device 800 further includes a verification module 606, which is specifically used for: Perform syntax verification, semantic verification, and execution verification on the target test cases after migration. The transfer results are determined based on the results of syntax validation, semantic validation, and execution validation. The syntax verification is used to check whether the migrated target test case can be correctly parsed by the compiler in the target chip platform. The semantic verification is used to check whether the data flow and control flow of the computation graph in the target test case are legal on the target chip platform. The execution verification is used to verify whether the difference between the output value obtained by the target test case running on the target chip platform or simulator and the preset expected output value in the test case to be migrated is less than a preset difference threshold.

[0216] In some embodiments, the verification module 606 is specifically used to include any one of the following: If the syntax validation, semantic validation, and execution validation all pass, the migration result is determined to be a successful migration. If the syntax validation and semantic validation pass, but the execution validation fails, the transfer result is determined to be subject to manual review. If the syntax validation fails but passes the syntax validation, semantic validation, and execution validation after automatic repair, the transfer result is determined to be automatically repaired. If semantic verification fails, the transfer result is determined to be non-transferable.

[0217] In some embodiments, the device 800 further includes a coverage analysis module 607, which is specifically used for: The operators contained in the migrated target test cases are compared with the operators contained in the target chip platform to determine the operator coverage of the target chip platform; The tensor shape contained in the migrated target test case is compared with the tensor shape contained in the target chip platform to determine the tensor shape coverage of the target chip platform. The data types contained in the migrated target test cases are compared with the data types contained in the target chip platform to determine the data type coverage of the target chip platform. The boundaries of the migrated target test cases are compared with the boundaries of the target chip platform to determine the boundary coverage of the target chip platform.

[0218] In some embodiments, the coverage analysis module 607 is further configured to: The difference between the expected operator coverage and the operator coverage of the target chip platform is defined as the operator coverage gap. The difference between the desired tensor shape coverage and the tensor shape coverage of the target chip platform is defined as the tensor shape coverage gap. The difference between the expected data type coverage and the data type coverage of the target chip platform is defined as the data type coverage gap. The difference between the desired boundary coverage and the boundary coverage of the target chip platform is defined as the boundary coverage gap.

[0219] In some embodiments, the coverage analysis module 607 is further configured to: Based on the uncovered operators, tensor shapes, data types, and boundaries in the target chip platform, generate test case supplementation suggestions.

[0220] In some embodiments, the test case filtering module 601 is specifically used for: Obtain the hardware characteristics of the source chip platform and the target chip platform; Based on the hardware characteristics of the source chip platform and the target chip platform, determine the hardware similarity between the source chip platform and the target chip platform; Based on the hardware similarity, the test cases to be migrated are determined from the test cases of the source chip platform.

[0221] In some embodiments, the test case filtering module 601 is specifically used for: Obtain the hardware feature vectors of the source chip platform and the target chip platform in terms of multi-dimensional hardware features; The multidimensional hardware features include at least two of the following hardware features: computing unit type, systolic array size, on-chip static random access memory capacity, number of high-bandwidth memory levels, memory bandwidth, set of supported data types, parallel model, maximum tensor dimension, supported fusion operators, and supported sparse computation.

[0222] In some embodiments, the test case filtering module 601 is specifically used for: The weighted similarity between the hardware feature vectors of the source chip platform and the target chip platform is calculated to obtain the hardware similarity between the source chip platform and the target chip platform.

[0223] In some embodiments, the test case filtering module 601 is specifically used for: If the hardware similarity is greater than or equal to the first similarity threshold, all test cases in the source chip platform will be identified as test cases to be migrated. If the hardware similarity is less than the first similarity threshold and greater than or equal to the second similarity threshold, a portion of test cases are selected from the source chip platform and determined as test cases to be migrated. If the hardware similarity is less than the second similarity threshold and greater than or equal to the third similarity threshold, the test cases corresponding to the atomic operators in the source chip platform are determined as test cases to be migrated. If the hardware similarity is less than the third similarity threshold, replace the source chip platform or build test cases from scratch for the target chip platform; The values ​​of the first similarity threshold, the second similarity threshold, and the third similarity threshold decrease sequentially.

[0224] In some embodiments, the computation unit type, the set of supported data types, the parallel model, the systolic array size, the memory bandwidth, the on-chip static random access memory capacity, the supported fusion operators, the number of high-bandwidth memory levels, the maximum tensor dimension, and the hardware feature weights of supported sparse computation decrease sequentially.

[0225] It should be noted that the test case migration device provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the test case migration device and the test case migration method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0226] Figure 9 This illustration shows a structural block diagram of a computer device provided in an exemplary embodiment of this application. The computer device 900 may be a terminal device or a server. Typically, the computer device 900 includes a processor 901 and a memory 902.

[0227] Processor 901 may include one or more processing cores, such as one or more of a quad-core processor or an octa-core processor. Processor 901 may be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), or PLA (Programmable Logic Array). Processor 901 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 901 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen.

[0228] The memory 902 may include one or more computer-readable storage media, which may be tangible and non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices.

[0229] In some embodiments, the non-transitory computer-readable storage medium in memory 902 stores at least one instruction, which is executed by processor 901 to implement the test case migration method provided in this application embodiment. In some embodiments, computer device 900 may also optionally include: peripheral device interface 903 and at least one peripheral device. Processor 901, memory 902 and peripheral device interface 903 can be connected via a bus or signal line. Each peripheral device can be connected to peripheral device interface 903 via a bus, signal line or circuit board. Specifically, the peripheral device includes at least one of: radio frequency circuit 904, touch display screen 905, camera assembly 906, audio circuit 907 and power supply 908.

[0230] The radio frequency (RF) circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals.

[0231] The touch display screen 905 is used to display a user interface (UI). This UI may include graphics, text, icons, video, and any combination thereof. The touch display screen 905 also has the ability to acquire touch signals on or above its surface.

[0232] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front-facing camera and a rear-facing camera.

[0233] Audio circuit 907 is used to provide an audio interface between the user and computer device 900.

[0234] Power supply 908 is used to supply power to the various components in computer device 900.

[0235] In some embodiments, the computer device 900 further includes one or more sensors 909. The one or more sensors 909 include, but are not limited to, an accelerometer 910, a gyroscope 911, a pressure sensor 912, an optical sensor 913, and a proximity sensor 914.

[0236] Those skilled in the art will understand that the above structure does not constitute a limitation on the computer device 900, and may include more or fewer components than shown, or combine certain components, or employ different component arrangements.

[0237] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the test case migration method provided in the above-described method embodiments.

[0238] This application also provides a computer program product, which includes at least one computer program stored in a computer-readable storage medium; the at least one computer program is read from and executed by a processor of a computer device from the computer-readable storage medium, causing the computer device to perform the test case migration method provided in the above-described method embodiments.

[0239] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.

[0240] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as one or more read-only memories, disks, or optical discs.

[0241] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A test case migration method, characterized in that, The method includes: Identify the test cases to be migrated from the test cases of the source chip platform; Obtain constraint mapping relationships, which are used to indicate the constraint relationships between the source chip platform and the target chip platform on use case elements. Different types of use case elements correspond to different constraint mapping relationships. The test cases to be migrated are parsed to obtain the first test case elements contained in the test cases to be migrated; Based on the constraint mapping relationship corresponding to the first use case element, the first use case element is adjusted to obtain the second use case element; the test case to be migrated containing the second use case element is the target test case; The target test cases are migrated to the target chip platform.

2. The method according to claim 1, characterized in that, The first use case element includes: use case attribute information; The step of adjusting the first use case element according to the constraint mapping relationship corresponding to the first use case element to obtain the second use case element includes: Determine the constraint relationship of the use case attribute information included in the constraint mapping relationship corresponding to the first use case element; The first use case element is adjusted based on the constraint relationship of the use case attribute information to obtain the second use case element.

3. The method according to claim 2, characterized in that, The type of the use case element includes an operator; the first use case element includes a first operator corresponding to the source chip platform; the second use case element includes a second operator corresponding to the target chip platform; The first operator is obtained by parsing the test cases to be migrated; The use case attribute information includes operator parameters, and the constraint relationship of the use case attribute information includes: when the first operator is mapped to the second operator, the intermediate operator corresponding to the first operator and the method of adjusting the operator parameters of the intermediate operator; The step of adjusting the first use case element based on the constraint relationship of the use case attribute information to obtain the second use case element includes: Replace the first operator with the intermediate operator; According to the operator parameter adjustment method, the operator parameters of the intermediate operator are adjusted to obtain the second operator.

4. The method according to claim 3, characterized in that, The operator parameter adjustment methods include one or more of the following: rearranging dimension labels, mapping after conversion according to the filling format, mapping after splitting according to the reduction operator type, and no mapping.

5. The method according to claim 2, characterized in that, The type of the use case element includes tensor shape; the first use case element includes a first tensor shape corresponding to the source chip platform; the second use case element includes a second tensor shape corresponding to the target chip platform; the first tensor shape is obtained by parsing the test case to be migrated; the use case attribute information includes the target tile of the tensor shape, and the constraint relationship of the use case attribute information includes: when mapping the first tensor shape to the second tensor shape, the alignment requirement of tensor shape alignment according to the target tile, the alignment requirement includes upward alignment to an integer multiple of the target tile; The step of adjusting the first use case element based on the constraint relationship of the use case attribute information to obtain the second use case element includes: The first tensor shape is aligned upwards to an integer multiple of the target tile to obtain the second tensor shape.

6. The method according to claim 2, characterized in that, The type of the use case element includes a data type; the first use case element includes a first data type corresponding to the source chip platform; The second use case element includes: a second data type corresponding to the target chip platform; the first data type is obtained by parsing the test case to be migrated; the use case attribute information includes the tolerance of the data type, and the constraint relationship of the use case attribute information includes: when the first data type is mapped to the second data type, the third data type corresponding to the first data type and the tolerance adjustment method of the third data type; The step of adjusting the first use case element based on the constraint relationship of the use case attribute information to obtain the second use case element includes: Replace the first data type with the third data type; According to the tolerance adjustment method, the third data type is adjusted to obtain the second data type.

7. The method according to claim 6, characterized in that, The tolerance adjustment methods include one or more of the following: one-to-one replacement with unchanged tolerance, precision conversion with relaxed tolerance, format conversion with dynamic tolerance adjustment, and downgrade mapping with recalibrated parameters.

8. The method according to claim 2, characterized in that, The type of the use case element includes memory resources; the first use case element includes the first memory resources corresponding to the source chip platform; the second use case element includes the second memory resources corresponding to the target chip platform; The first memory resource is obtained by parsing the test cases to be migrated; The use case attribute information includes batch size and / or tensor block size, and the constraint relationship of the use case attribute information includes: when the first memory resource is mapped to the second memory resource, the batch size adjustment method and / or tensor block size adjustment method corresponding to the first memory resource; The step of adjusting the first use case element based on the constraint relationship of the use case attribute information to obtain the second use case element includes: According to the batch size adjustment method, the batch size on the first memory resource is adjusted, and the adjusted batch size is greater than or equal to 1; and / or, According to the tensor block size adjustment method, the tensor block size on the first memory resource is adjusted to obtain the second memory resource.

9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: For each third operator included in the test case to be migrated, if there is no third operator and its corresponding substitute operator in the target chip platform, the third operator and its corresponding subgraph are deleted from the computation graph of the test case to be migrated. The third operator is any one of the operators included in the test case to be migrated.

10. The method according to claim 9, characterized in that, Before deleting the third operator and its corresponding subgraph from the computation graph of the test case to be migrated, the method further includes: Search the equivalent computation graph database for candidate alternative subgraphs composed of operators supported by the target chip platform, the candidate alternative subgraphs being used to equivalently implement the computational function of the third operator; The candidate alternative subgraph is subjected to at least one verification, which includes one or more of the following: shape consistency verification, data type validity verification, sampling numerical equivalence verification, and computational envelope verification. If all at least one verification passes, the third operator in the test case is replaced with the candidate alternative subgraph; If the candidate alternative subgraph is not found in the equivalent computation graph database, or if at least one verification fails, the step of deleting the third operator and the subgraph corresponding to the third operator from the test case is performed, or the third operator is marked as non-transferable.

11. The method according to any one of claims 1 to 8, characterized in that, After migrating the target test cases to the target chip platform, the method further includes: Perform syntax verification, semantic verification, and execution verification on the target test cases after migration. The transfer results are determined based on the results of syntax validation, semantic validation, and execution validation. The syntax verification is used to check whether the migrated target test case can be correctly parsed by the compiler in the target chip platform. The semantic verification is used to check whether the data flow and control flow of the computation graph in the target test case are legal on the target chip platform. The execution verification is used to verify whether the difference between the output value obtained by the target test case running on the target chip platform or simulator and the preset expected output value in the test case to be migrated is less than a preset difference threshold.

12. The method according to claim 11, characterized in that, The determination of the transfer result based on the syntax verification result, semantic verification result, and execution verification result includes any one of the following: If the syntax validation, semantic validation, and execution validation all pass, the migration result is determined to be a successful migration. If the syntax validation and semantic validation pass, but the execution validation fails, the transfer result is determined to be subject to manual review. If the syntax validation fails but passes the syntax validation, semantic validation, and execution validation after automatic repair, the transfer result is determined to be automatically repaired. If semantic verification fails, the transfer result is determined to be non-transferable.

13. The method according to any one of claims 1 to 8, characterized in that, The method further includes: The operators contained in the migrated target test cases are compared with the operators contained in the target chip platform to determine the operator coverage of the target chip platform; The tensor shape contained in the migrated target test case is compared with the tensor shape contained in the target chip platform to determine the tensor shape coverage of the target chip platform. The data types contained in the migrated target test cases are compared with the data types contained in the target chip platform to determine the data type coverage of the target chip platform. The boundaries of the migrated target test cases are compared with the boundaries of the target chip platform to determine the boundary coverage of the target chip platform.

14. The method according to claim 13, characterized in that, The method further includes: The difference between the expected operator coverage and the operator coverage of the target chip platform is defined as the operator coverage gap. The difference between the desired tensor shape coverage and the tensor shape coverage of the target chip platform is defined as the tensor shape coverage gap. The difference between the expected data type coverage and the data type coverage of the target chip platform is defined as the data type coverage gap. The difference between the desired boundary coverage and the boundary coverage of the target chip platform is defined as the boundary coverage gap.

15. The method according to claim 14, characterized in that, The method further includes: Based on the uncovered operators, tensor shapes, data types, and boundaries in the target chip platform, generate test case supplementation suggestions.

16. The method according to any one of claims 1 to 8, characterized in that, The test cases to be migrated are determined from the test cases of the source chip platform, including: Obtain the hardware characteristics of the source chip platform and the target chip platform; Based on the hardware characteristics of the source chip platform and the target chip platform, determine the hardware similarity between the source chip platform and the target chip platform; Based on the hardware similarity, the test cases to be migrated are determined from the test cases of the source chip platform.

17. The method according to claim 16, characterized in that, The acquisition of the hardware features of the source chip platform and the target chip platform includes: Obtain hardware feature vectors of the source chip platform and the target chip platform in multidimensional hardware features; wherein, the multidimensional hardware features include at least two of the following hardware features: computing unit type, systolic array size, on-chip static random access memory capacity, number of high-bandwidth memory levels, memory bandwidth, set of supported data types, parallel model, maximum tensor dimension, supported fusion operators, and supported sparse computation.

18. The method according to claim 16, characterized in that, Determining the hardware similarity between the source chip platform and the target chip platform based on the hardware characteristics of the source chip platform and the target chip platform includes: The weighted similarity between the hardware feature vectors of the source chip platform and the target chip platform is calculated to obtain the hardware similarity between the source chip platform and the target chip platform.

19. The method according to claim 16, characterized in that, The step of determining the test cases to be migrated from the test cases of the source chip platform based on the hardware similarity includes: If the hardware similarity is greater than or equal to the first similarity threshold, all test cases in the source chip platform will be identified as test cases to be migrated. If the hardware similarity is less than the first similarity threshold and greater than or equal to the second similarity threshold, a portion of test cases are selected from the source chip platform and determined as test cases to be migrated. If the hardware similarity is less than the second similarity threshold and greater than or equal to the third similarity threshold, the test cases corresponding to the atomic operators in the source chip platform are determined as test cases to be migrated. If the hardware similarity is less than the third similarity threshold, replace the source chip platform or build test cases from scratch for the target chip platform; The values ​​of the first similarity threshold, the second similarity threshold, and the third similarity threshold decrease sequentially.

20. The method according to claim 18, characterized in that, The hardware feature weights of the computation unit type, supported data type set, parallel model, systolic array size, memory bandwidth, on-chip static random access memory capacity, supported fusion operators, number of high-bandwidth memory levels, maximum tensor dimension, and supported sparse computation decrease sequentially.

21. A test case migration device, characterized in that, The device includes: The test case filtering module is used to determine the test cases to be migrated from the test cases of the source chip platform; The acquisition module is used to acquire constraint mapping relationships, which are used to indicate the constraint relationships between the source chip platform and the target chip platform on use case elements. Different types of use case elements correspond to different constraint mapping relationships. The parsing module is used to parse the test cases to be migrated to obtain the first test case elements contained in the test cases to be migrated; The adjustment module is used to adjust the first test case element according to the constraint mapping relationship corresponding to the first test case element to obtain the second test case element; the test case to be migrated containing the second test case element is the target test case; The migration module is used to migrate the target test cases to the target chip platform.

22. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the test case migration method as described in any one of claims 1 to 20.

23. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is loaded and executed by a processor to implement the test case migration method as described in any one of claims 1 to 20.