Data access method and device, electronic equipment, storage medium and program product

By introducing generation identifiers into generic virtual addresses, the problem of relying on software instrumentation for generic address lifecycle management is solved, enabling hardware to automatically determine the validity of generic virtual addresses, preventing misuse, and improving processor access security and efficiency.

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

Patent Information

Application Number
CN202610647483.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-11-20
Estimated Expiration
2046-05-12

AI Technical Summary

Technical Problem

In modern graphics processing units (GPUs) or other parallel processors that support a unified address model, the lifecycle management of generic addresses relies on software instrumentation or runtime checks, which incurs additional overhead and makes it difficult to cover all paths. This can lead to the misuse of generic virtual addresses, resulting in unauthorized access or data anomalies.

Method used

The generated identifier is introduced into the general virtual address, and its validity is automatically determined by the hardware to prevent misuse. The generated identifier is read and compared in the general address register to avoid software instrumentation and runtime detection.

Benefits of technology

It enables automatic hardware determination of the validity of the generic virtual address during the access phase, reducing latency and overhead, covering all scenarios that require the use of the generic virtual address, and preventing unauthorized access and data anomalies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173145B_ABST
    Figure CN122173145B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data access method and device, electronic equipment, storage medium and program product. The method is applied to a processor, and includes: in response to a memory access request of a first processing task currently executed in the processor, obtaining a general virtual address corresponding to the memory access request from a general address register of the processor, the first processing task corresponding to a first generation identifier; obtaining a second generation identifier from the general virtual address, the second generation identifier being used to indicate that the general virtual address is valid during execution of a second processing task; and in a case where the first generation identifier is the same as the second generation identifier, performing a memory access operation of the memory access request. According to the embodiments of the present disclosure, address verification can be performed simply and quickly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of processors, and more particularly to a data access method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] In modern graphics processing units (GPUs) or other parallel processors that support a uniform address model, generic addresses are widely used to mask the differences between different memory spaces, enabling software to generate and pass addresses in a uniform manner.

[0003] Lifecycle management of generic addresses mainly relies on software instrumentation or runtime checks, which incurs additional overhead and makes it difficult to cover all paths. Summary of the Invention

[0004] This disclosure provides a data access method, apparatus, electronic device, storage medium, and program product.

[0005] In a first aspect, this disclosure provides a data memory access method applied to a processor. The method includes: in response to a memory access request of a first processing task currently being executed in the processor, obtaining a general virtual address corresponding to the memory access request from the processor's general address register; a first generation identifier corresponding to the first processing task; obtaining a second generation identifier from the general virtual address; the second generation identifier being used to indicate that the general virtual address is valid during the execution of the second processing task; and, if the first generation identifier and the second generation identifier are the same, performing a memory access operation of the memory access request.

[0006] In one possible implementation, the method further includes: when starting the second processing task, generating a second generation identifier based on the identifier of the second processing task, and storing the second generation identifier in the metadata of the second processing task; during the execution of the second processing task, in response to the operation of generating a general virtual address, generating an initial virtual address based on the base address and offset address corresponding to the second processing task, and obtaining the second generation identifier from the metadata of the second processing task; generating a general virtual address based on the initial virtual address and the second generation identifier; and storing the general virtual address in a general address register.

[0007] In one possible implementation, generating a generic virtual address based on the initial virtual address and the second generation identifier includes: writing the second generation identifier into the address window of the initial virtual address to obtain the generic virtual address.

[0008] In one possible implementation, generating a general virtual address based on an initial virtual address and a second generation identifier includes: determining the bit width of the general address register as the bit width of the general virtual address, wherein the bit width of the initial virtual address is smaller than the bit width of the general virtual address; writing the initial virtual address into the low-order address region of the general virtual address, and writing the second generation identifier into the address region of the general virtual address excluding the low-order address region, thereby obtaining the general virtual address, wherein the bit width of the low-order address region is the same as the bit width of the initial virtual address.

[0009] In one possible implementation, the method further includes: in response to a memory access request, obtaining a first generation identifier from the metadata of the first processing task.

[0010] In one possible implementation, the method further includes: performing an exception operation if the first generation identifier and the second generation identifier are different; wherein the exception operation includes at least one of the following: blocking memory access requests; generating an exception signal; and returning a preset error result.

[0011] In one possible implementation, the method further includes at least one of the following: deleting the first generation identifier from the metadata of the first processing task when the first processing task finishes execution; setting the first generation identifier in the metadata of the first processing task to invalid when the first processing task undergoes a context switch; and updating the first generation identifier in the metadata of the first processing task when the processor's storage space is reallocated or initialized.

[0012] Secondly, this disclosure provides a data memory access device applied to a processor. The device includes: a first acquisition module, configured to acquire a general virtual address corresponding to the memory access request from the processor's general address register in response to a memory access request of a first processing task currently being executed in the processor, wherein the first processing task corresponds to a first generation identifier; a second acquisition module, configured to acquire a second generation identifier from the general virtual address, wherein the second generation identifier is used to indicate that the general virtual address is valid during the execution of the second processing task; and a first execution module, configured to execute the memory access operation of the memory access request if the first generation identifier and the second generation identifier are the same.

[0013] In one possible implementation, the apparatus further includes: a first generation module, configured to generate a second generation identifier based on the identifier of the second processing task when the second processing task is started, and to store the second generation identifier in the metadata of the second processing task; a second generation module, configured to generate an initial virtual address based on a base address and an offset address in response to an operation of generating a general virtual address during the execution of the second processing task, and to obtain the second generation identifier from the metadata of the second processing task; a third generation module, configured to generate a general virtual address based on the initial virtual address and the second generation identifier; and a storage module, configured to store the general virtual address in a general address register.

[0014] In one possible implementation, the third generation module is specifically used to: write the second generation identifier into the address window of the initial virtual address to obtain a general virtual address.

[0015] In one possible implementation, the third generation module is specifically used to: determine the bit width of the general address register as the bit width of the general virtual address, wherein the bit width of the initial virtual address is smaller than the bit width of the general virtual address; write the initial virtual address into the low-order address area of ​​the general virtual address, and write the second generation identifier into the address area of ​​the general virtual address other than the low-order address area, to obtain the general virtual address, wherein the bit width of the low-order address area is the same as the bit width of the initial virtual address.

[0016] In one possible implementation, the apparatus further includes a third acquisition module, configured to acquire a first generation identifier from the metadata of the first processing task in response to a memory access request.

[0017] In one possible implementation, the device further includes: a second execution module, configured to perform an abnormal operation if the first generated identifier and the second generated identifier are different; wherein the abnormal operation includes one or more of the following: blocking memory access requests; generating an abnormal signal; and returning a preset error result.

[0018] In one possible implementation, the apparatus further includes: a deletion module, configured to delete a first generation identifier from the metadata of the first processing task when the execution of the first processing task ends; and / or a setting module, configured to set the first generation identifier in the metadata of the first processing task to invalid when a context switch occurs in the first processing task; and / or an update module, configured to update the first generation identifier in the metadata of the first processing task when the processor's storage space is reallocated or initialized.

[0019] Thirdly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the data access method described above.

[0020] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described data access method.

[0021] The embodiments provided in this disclosure, in response to a memory access request from a first processing task currently being executed in the processor, obtain a general virtual address corresponding to the memory access request from the processor's general address register, and generate a second identifier from the general virtual address. This second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task. If the first generated identifier corresponding to the currently executing first processing task is the same as the second generated identifier in the general virtual address, the memory access operation of the memory access request is performed. In this way, by introducing a generated identifier indicating the validity of the general address into the general address, the hardware can automatically determine whether the general virtual address is valid during the access phase, preventing the general virtual address from being misused. At the same time, the process of the hardware directly reading the general virtual address from the general address register and obtaining the generated identifier from the general virtual address for comparison does not require software instrumentation or runtime detection. The verification logic is simple, the latency is low, and it covers all scenarios that require the use of general virtual addresses.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0023] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed exemplary embodiments described with reference to the accompanying drawings.

[0024] Figure 1 This is a flowchart of a data access method provided in an embodiment of the present disclosure.

[0025] Figure 2 This is a schematic diagram of a general virtual address provided in an embodiment of this disclosure.

[0026] Figure 3This is a schematic diagram of a general virtual address provided in an embodiment of this disclosure.

[0027] Figure 4 This is a schematic diagram of the structure of a processor provided in an embodiment of the present disclosure.

[0028] Figure 5 This is a block diagram of a data access device provided in an embodiment of the present disclosure.

[0029] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0030] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0031] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0032] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0033] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0034] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0035] A generic address is a purely numerical address representation. In GPUs or other parallel processors that support a unified address model, generic addresses are typically used to mask the differences between different memory spaces, enabling software to generate and pass addresses in a uniform manner.

[0036] A dangling address is created if a general address is incorrectly propagated out of bounds or even saved and reused across kernel functions. After a context switch or kernel function ends, a valid general address that was valid before the switch or function may point to reclaimed or reallocated memory resources; continued use of such an address will result in unauthorized access or data corruption. If a general address in shared or local memory is incorrectly propagated to a context without the necessary access rights, it will lead to out-of-bounds access or data corruption.

[0037] In related technologies, software conventions are used to manage the lifecycle of generic addresses. For example, software can stipulate one or more of the following: addresses are only used within the current kernel function; addresses should not be stored across kernels; addresses should not be stored across contexts; and the validity of addresses is guaranteed by the compiler or programmer.

[0038] However, the software conventions used in related technologies rely on software instrumentation or runtime checks, which introduces additional overhead, and this approach is difficult to cover all paths.

[0039] According to the data memory access method of this disclosure, in response to a memory access request from a first processing task currently being executed in the processor, a general virtual address corresponding to the memory access request is obtained from the processor's general address register, and a second generated identifier is generated from the general virtual address. This second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task. If the first generated identifier corresponding to the currently executing first processing task is the same as the second generated identifier in the general virtual address, the memory access operation of the memory access request is performed. In this way, by introducing a generated identifier indicating the validity of the general address into the general address, the hardware can automatically determine whether the general virtual address is valid during the access phase, preventing the general virtual address from being misused. At the same time, the process of the hardware directly reading the general virtual address from the general address register and obtaining the generated identifier from the general virtual address for comparison does not require software instrumentation or runtime detection. The verification logic is simple, the latency is low, and it covers all scenarios that require the use of general virtual addresses.

[0040] The data memory access method according to embodiments of this disclosure can be executed by a processor. The processor can be a GPU or other parallel processor supporting a unified address model, and can be located in electronic devices such as terminal devices or servers. The terminal device can be an in-vehicle device, user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, wearable device, etc. The data memory access method according to embodiments of this disclosure can be implemented by the processor calling computer-readable program instructions stored in memory.

[0041] Figure 1 This is a flowchart illustrating a data memory access method provided in an embodiment of this disclosure. The method is applied to a processor. In one example, the processor can be a GPU or other parallel processor that supports a unified address model. (Refer to...) Figure 1 The data access method includes the following steps.

[0042] In step S11, in response to a memory access request from the first processing task currently being executed in the processor, a general virtual address corresponding to the memory access request is obtained from the processor's general address register; the first processing task corresponds to a first generation identifier.

[0043] A processor can execute multiple processing tasks in parallel, allocating independent resources to each task. In one example, a processing task could be a complete application task.

[0044] In one example, a processing task can be a kernel function. A kernel function is a function unit with independent computational logic that can be independently scheduled and executed by the processor; it is a form of processing task. A kernel function can perform specific computations or data processing operations, and can initiate memory access requests to retrieve or write the data required for the computation. A kernel function can be scheduled and executed by the processor as an independent processing task. A kernel function has its own virtual address space and instruction stream. In another example, a processing task can include multiple kernel functions; the coordinated execution of multiple kernel functions can complete the functionality of the entire processing task. Processing tasks also have their own virtual address spaces and instruction streams. For example, a processing task could be a user data query task, or a data retrieval kernel function within a data query task.

[0045] The first processing task can represent the task currently being executed. The first processing task can initiate memory access requests to retrieve data from or write data to memory (such as RAM). Memory access requests can be divided into two types: read requests and write requests.

[0046] The first generated identifier can represent the generation identifier of the first processing task. In this embodiment of the present disclosure, the processor can generate the first generated identifier when starting the first processing task and delete the first generated identifier when ending the first processing task. That is, the first generated identifier is generated when the first processing task starts, disappears when the first processing task ends, and is valid throughout the entire execution cycle of the first processing task. The first generated identifier can be used to identify the first processing task.

[0047] In one example, the processor can determine the identifier of the first processing task as the first generated identifier. In another example, the processor can generate the first generated identifier based on the identifier of the first processing task. For example, the identifier of the first processing task can be encrypted (e.g., using hash encryption or symmetric encryption), and the encrypted result can be used as the first generated identifier. Alternatively, time information (e.g., the start time of the first processing task) can be added to the identifier of the first processing task to obtain the first generated identifier.

[0048] The identifier of the first processing task can be used to uniquely identify the first processing task. For example, the identifier of the first processing task can be a task number, a task process ID, a kernel function number, etc. Based on this, the first generation identifier can also be used to uniquely identify the first processing task.

[0049] The general-purpose address register is a high-speed memory unit inside the processor used to store general-purpose virtual addresses. The bit width of the general-purpose address register can be 32 bits or 64 bits, etc., and this embodiment of the present disclosure does not impose any limitations on this. When the first processing task initiates a memory access request, the processor can read the general-purpose virtual address corresponding to the first processing task from the general-purpose address register.

[0050] Each processing task has its own independent virtual address space, and each processing task can only access its own portion of the virtual address space. Any out-of-bounds access will be considered an illegal operation and trigger an exception. In response to the memory access request of the first processing task, the processor can determine the corresponding virtual address space based on the identity identifier of the first processing task (such as task number, Kernel ID, etc.), for example, determining the starting address of that virtual address space.

[0051] A general-purpose virtual address is a logical address used to identify the location of data in memory (such as main memory). It is a virtual address, not a physical address in memory. The general-purpose virtual address indicates a virtual address within the virtual address space accessible to the first processing task. The memory access request carries an address offset indicating the storage location of the general-purpose virtual address within the corresponding virtual address space. In response to the memory access request from the first processing task, the processor first determines the starting address of the corresponding virtual address space, and then, based on this address offset, reads the general-purpose virtual address corresponding to the first processing task.

[0052] After the processor obtains the general virtual address corresponding to the first processing task, it can convert the general virtual address into a physical address to enable actual access to the storage device.

[0053] In step S12, a second generated identifier is obtained from the general virtual address; the second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task.

[0054] The second processing task can represent any processing task. The second processing task may be the same as the first processing task, or it may not be the same as the first processing task. For example, the second processing task can be a task that is executed before the first processing task starts, a task that is executed after the first processing task finishes, a processing task that is executed after a context switch operation is performed on the first processing task, or a processing task that is executed in parallel with the first processing task.

[0055] The second generated identifier can represent the generation identifier of the second processing task. In this embodiment of the present disclosure, the processor can generate the second generated identifier when starting the second processing task and delete the second generated identifier when ending the second task. That is, the second generated identifier is generated when the second processing task starts, disappears when the second task ends, and is valid throughout the entire execution cycle of the second processing task. The second generated identifier can be used to identify the second processing task.

[0056] The method for determining the second generation identifier can refer to the method for determining the first generation identifier. For example, the identifier of the second processing task can be determined as the second generation identifier, which will not be elaborated here. The identifier of the second processing task can refer to the identifier of the first processing task, which will also not be elaborated here.

[0057] In this embodiment of the disclosure, the general virtual address is a dedicated address resource allocated by the processor for the second processing task, and is valid only during the execution of the second processing task. The general virtual address carries a second generation identifier, which can be used to indicate that the general virtual address is valid during the execution of the second processing task; that is, the lifecycle of the general virtual task refers to the period from the start of the second processing task to the end of the second processing task.

[0058] In step S13, if the first generation identifier and the second generation identifier are the same, the memory access operation of the memory access request is performed.

[0059] A unique first processing task can be identified based on a first generated identifier, and a unique second processing task can be identified based on a second generated identifier. If the first and second generated identifiers are the same, it indicates that the first and second processing tasks are the same task. In this case, the general virtual address is valid during the execution of the second processing task, which means it is valid during the execution of the first processing task. Since the currently executing processing task is the first processing task, the general virtual address is valid at the current moment, and the processor can perform memory access operations for memory access requests, that is, read data from or write data to memory (such as main memory) based on the general virtual address.

[0060] Each processing task has its own independent virtual address space, and each task can only access its own portion of the virtual address space. In an example, considering processing tasks 1 and 2, task 1 has virtual address space 1, and task 2 has virtual address space 2. Task 1 can only access virtual address space 1, and task 2 can only access virtual address space 2. If task 1 accesses virtual address space 2, it will result in an out-of-bounds access error, leading to data corruption. Similarly, if task 2 accesses virtual address space 1, it will also result in an out-of-bounds access error, leading to data corruption.

[0061] A generic virtual address is a purely numerical address representation. Assume the generic virtual address is a virtual address in virtual address space 2, valid during the execution of task 2. In related technologies, when executing task 1, the processor can normally use the generic virtual address to perform memory access operations, resulting in out-of-bounds access. In this embodiment, the generic virtual address carries the generation identifier of task 2. When executing task 1, the processor finds that the generation identifier carried in the generic virtual address (i.e., the generation identifier of task 2) is different from the generation identifier of the currently executing task (i.e., the generation identifier of task 1). At this point, it can be determined that the generic virtual address is invalid, and memory access operations will not be performed based on the generic virtual address, thus preventing out-of-bounds access.

[0062] According to the data memory access method of this disclosure, in response to a memory access request from a first processing task currently being executed in the processor, a general virtual address corresponding to the memory access request is obtained from the processor's general address register, and a second generated identifier is generated from the general virtual address. This second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task. If the first generated identifier corresponding to the currently executing first processing task is the same as the second generated identifier in the general virtual address, the memory access operation of the memory access request is performed. In this way, by introducing a generated identifier indicating the validity of the general address into the general address, the hardware can automatically determine whether the general virtual address is valid during the access phase, preventing the general virtual address from being misused. At the same time, the process of the hardware directly reading the general virtual address from the general address register and obtaining the generated identifier from the general virtual address for comparison does not require software instrumentation or runtime detection. The verification logic is simple, the latency is low, and it covers all scenarios that require the use of general virtual addresses.

[0063] To enable verification of the generic virtual address, the generic virtual address carries a generation identifier in this embodiment. The generation process of the generic virtual address is described below. In some embodiments, the data access method further includes:

[0064] In step S14, when the second processing task is started, a second generation identifier is generated based on the identifier of the second processing task, and the second generation identifier is stored in the metadata of the second processing task.

[0065] The identifier for the second processing task can be used to uniquely identify the second processing task. The identifier for the second processing task can be referenced from the identifier for the first processing task, and will not be repeated here. The process of generating a second identifier based on the identifier for the second processing task can be referenced from the process of generating a first processing task based on the identifier for the first processing task, and will also not be repeated here.

[0066] The metadata of the second processing task refers to structured data that stores the attribute information of the second processing task. The metadata of the second processing task can record its identifier, address space, execution status, and priority information, etc. The metadata of the second processing task is the basis for the processor to manage the second processing task. The metadata of the second processing task can be stored in a dedicated memory cache or register.

[0067] When starting the second processing task, the processor can first obtain the identifier of the second processing task, then generate a second generation identifier based on the identifier of the second processing task, and save the second generation identifier in the metadata of the second processing task for later use.

[0068] In step S15, during the execution of the second processing task, in response to the operation of generating a general virtual address, an initial virtual address is generated based on the base address and offset address corresponding to the second processing task, and a second generation identifier is obtained from the metadata of the second processing task.

[0069] In step S16, a general virtual address is generated based on the initial virtual address and the second generation identifier.

[0070] In step S17, the general virtual address is stored in the general address register.

[0071] When a hardware unit in the processor needs to access memory resources, it first generates a virtual address and then performs the actual read / write operation after the virtual address is translated into a physical address. For example, the operation of generating a general virtual address may include load or store instructions in the kernel, and may also include fetching instructions from memory from the kernel. This embodiment of the present disclosure does not limit the operation of generating a general virtual address, as long as it can trigger the processor to generate a general virtual address.

[0072] The base address corresponding to the second processing task is the starting reference address of the virtual address allocated to the second processing task, used to determine the range of the virtual address space of the second processing task. The offset address corresponding to the second processing task is the address offset relative to the base address, used to locate the specific storage location. The initial virtual address is obtained by concatenating the base address and the offset address. In one example, the base address is 16 bits, the offset address is 16 bits, and concatenating them yields a 32-bit initial virtual address. The process of generating the initial virtual address based on the base address and offset address can be found in relevant technologies, and will not be elaborated here.

[0073] It should be understood that both the initial virtual address and the general virtual address are virtual addresses. The difference between them is that the initial virtual address does not carry a second generation identifier, while the general virtual address does. The processor can generate a general virtual address based on the initial virtual address and the second generation identifier.

[0074] In one possible implementation, step S16 generates a generic virtual address based on the initial virtual address and the second generation identifier, including: writing the second generation identifier into the address window of the initial virtual address to obtain the generic virtual address.

[0075] The address window is a reserved area in the initial virtual address space used to store information such as attributes, permissions, and mapping methods. In one example, the address window can be a high-order segment of the initial virtual address (e.g., the highest K bits, where K is a positive integer); for example, the high 4 bits of the initial virtual address can be used as the address window. The bit width of the address window is greater than or equal to the bit width of the second generated identifier. This allows the processor to write the second generated identifier into the address window. In one example, the processor can write the second generated identifier into the attribute extension bits or reserved bits of the address window.

[0076] Figure 2 This is a schematic diagram illustrating a general virtual address provided in an embodiment of this disclosure. (Refer to...) Figure 2 The general virtual address includes the initial virtual address, and the address window of the initial virtual address includes a second generation identifier. It should be understood that in this case, the bit width of the initial virtual address is less than or equal to the bit width of the general virtual address. Specifically, when the bit width of the initial virtual address is less than the bit width of the general virtual address, the general virtual address can be obtained by padding the high bits of the initial virtual address with 0s.

[0077] As one implementation of this disclosure, by writing the second generation identifier into the address window of the initial virtual address, the bit width of the general virtual address and the initial virtual address can be kept the same, and the resulting general virtual address can be adapted to the processing logic of the existing virtual address, thus having strong compatibility.

[0078] In one possible implementation, step S16 generates a general virtual address based on the initial virtual address and the second generation identifier, including: determining the bit width of the general address register as the bit width of the general virtual address, wherein the bit width of the initial virtual address is smaller than the bit width of the general virtual address; writing the initial virtual address into the low-order address area of ​​the general virtual address, and writing the second generation identifier into the address area of ​​the general virtual address other than the low-order address area, to obtain the general virtual address, wherein the bit width of the low-order address area is the same as the bit width of the initial virtual address.

[0079] The general-purpose address register is used to store general-purpose virtual addresses. In one example, the width of the general-purpose address register can be 32 bits or 64 bits, etc. To ensure proper address access and recognition, the width of the general-purpose virtual address is consistent with the width of the general-purpose address register.

[0080] The low-order address region represents the lower-order area of ​​the general virtual address. It can be used to store the initial virtual address, and its width is the same as the initial virtual address. In one example, if the width of the low-order address region is A, then bits 0 to A-1 of the general virtual address are the low-order address region.

[0081] In one example, assuming the general address register has a bit width of 32 bits, the corresponding general virtual address also has a bit width of 32 bits, and the initial virtual address has a bit width of 16 bits, then the initial virtual address can be written into the lower 16 bits of the general virtual address, and the second generation identifier can be written into the higher 16 bits of the general virtual address.

[0082] Figure 3 This is a schematic diagram illustrating a general virtual address provided in an embodiment of this disclosure. (Refer to...) Figure 3 The general virtual address includes an initial virtual address and a second generated identifier. The initial virtual address is located in the low address region of the general virtual address, and the second generated identifier is located in the high address region of the general virtual address. There are no overlapping bits between the initial virtual address and the second generated identifier.

[0083] It should be understood that the sum of the bit width of the second generated identifier and the bit width of the initial virtual address is less than or equal to the bit width of the general virtual address. When the sum of the bit width of the second generated identifier and the bit width of the initial virtual address is less than the bit width of the general address: if the most significant bit of the second generated identifier occupies the most significant bit of the general virtual address, the general virtual address can be obtained by padding the empty spaces between the initial virtual address and the second generated identifier with 0s; if the least significant bit of the second generated identifier is adjacent to the most significant bit of the initial virtual address, the general virtual address can be obtained by padding the empty spaces before the most significant bit of the second generated identifier with 0s; if the least significant bit of the second generated identifier is not adjacent to the most significant bit of the initial virtual address and the most significant bit of the second generated identifier does not occupy the most significant bit of the general virtual address, the general virtual address can be obtained by padding the empty spaces between the initial virtual address and the second generated identifier, and also by padding the empty spaces before the least significant bit of the second generated identifier with 0s. No specific limitations are imposed on this.

[0084] based on Figure 2 and Figure 3 As can be seen from the general virtual address shown, the general virtual address provided in this embodiment of the disclosure contains at least two fields: a generation identifier field and an original address data field. Figure 2 In the general virtual address shown, the generation identifier field is located in the address window, and the original address data field is located in the area of ​​the initial virtual address other than the address window. Figure 3 In the general virtual address shown, the generation identifier field is located in the high-order address area, and the original address data field is located in the low-order address area. The generation identifier field represents the lifecycle of the general virtual address. For example, when the generation identifier field is generation identifier 1 for processing task 1, it means that the lifecycle of the general virtual address is the execution cycle of processing task 1; when the generation identifier field is generation identifier 2 for processing task 2, it means that the lifecycle of the general virtual address is the execution cycle of processing task 2.

[0085] As one embodiment of this disclosure, the initial virtual address and the second generated identifier are stored in partitioned storage, which can reduce the interference of the second generated identifier on the initial virtual address, ensure the accuracy of the conversion from virtual address to physical address, and reduce the possibility of address errors. At the same time, this partitioned storage facilitates the processor to quickly implement address splicing and parsing through hardware, adapts to the large-scale address generation needs in multi-core and parallel computing scenarios, and improves the efficiency of address generation. In addition, the bit width of the second generated identifier can be flexibly adjusted, which has strong scalability.

[0086] It should be understood that the above is only an exemplary description of generating a general virtual address based on the initial virtual address and the second generation identifier. A general virtual address can also be generated in other ways, such as concatenating the generation identifier after the virtual address to obtain a general virtual address. This disclosure does not limit the scope of the embodiments.

[0087] The process of obtaining the first generated identifier is described below. In some embodiments, the data access method further includes: in step S18, in response to a memory access request, obtaining the first generated identifier from the metadata of the first processing task.

[0088] The metadata of the first processing task can be referenced from the metadata of the second processing task. When starting the first processing task, the processor can first obtain the identifier of the first processing task, then generate a first generation identifier based on the identifier of the first processing task, and store the first generation identifier in the metadata of the first processing task. Subsequently, in response to a memory access request, the processor can obtain the first generation identifier from the metadata of the first processing task for comparison with the second generation identifier.

[0089] As one implementation of this disclosure, by writing the first generation identifier into the metadata of the first processing task, the first generation identifier is bound to the first processing task. Thus, when there is a memory access request, the first generation identifier can be directly retrieved from the metadata of the first processing task, reducing the query time of the first generation identifier, improving the efficiency of memory access verification, and ensuring the security of the first generation identifier, reducing the possibility of the first generation identifier being tampered with or forged, and improving reliability.

[0090] The following describes the handling method for the case where the first generated identifier and the second generated identifier are different. In some embodiments, the data access method further includes: in step S19, if the first generated identifier and the second generated identifier are different, performing an abnormal operation; wherein the abnormal operation includes one or more of the following: blocking the memory access request; generating an abnormal signal; returning a preset error result.

[0091] A first generated identifier can uniquely identify a first processing task, and a second generated identifier can uniquely identify a second processing task. If the first generated identifier and the second generated identifier are different, it indicates that the first processing task and the second processing task are different processing tasks.

[0092] Since the general-purpose virtual address is only valid during the execution of the second processing task, but the first and second processing tasks are different, the general-purpose virtual address is invalid during the execution of the first processing task. Because the currently executing processing task is the first processing task, the general-purpose virtual address is invalid at the current moment. If the processor executes a memory access request, it may cause out-of-bounds access or data errors. Therefore, if the first generated identifier and the second generated identifier are different, the processor can perform an abnormal operation.

[0093] In one example, if the first generated identifier and the second generated identifier are different, the processor can block the memory access request, such as by discarding the memory access request, blocking the address translation process, or refusing access to physical memory. This prevents illegal data reads and writes.

[0094] In another example, when the first generation identifier and the second generation identifier are different, the processor can generate an exception signal to trigger system log recording, which makes it easier for maintenance personnel to investigate unauthorized memory access behavior.

[0095] In another example, if the first generation identifier and the second generation identifier differ, the processor can return a preset error result. For example, when the memory access request is a load instruction, it can return 0. This prevents the first processing task from crashing due to memory access failure, ensuring system stability.

[0096] As one implementation of this disclosure, when the first generated identifier and the second generated identifier are different, abnormal operations are performed from multiple dimensions. This allows for flexible combination of various protection mechanisms to adapt to different security levels, reducing the possibility of accessing outside the bounds or data errors due to the use of invalid general addresses, and improving system stability.

[0097] In some embodiments, the data access method further includes at least one of the following.

[0098] In step S20, if the first processing task has finished executing, the first generation identifier is deleted from the metadata of the first processing task.

[0099] After the first processing task is completed, the processor can delete the first generated identifier from the metadata of the first processing task. In this way, when the general virtual address carrying the first generated identifier is used subsequently, the processor cannot obtain the first generated identifier from the metadata, which prevents misjudgment of the validity of the general virtual address and improves the accuracy of the general virtual address verification.

[0100] In step S21, if a context switch occurs in the first processing task, the first generation identifier in the metadata of the first processing task is set to invalid.

[0101] In this embodiment of the disclosure, the processor can be used to execute multiple processing tasks, which may have different priorities and resource requirements. In one example, a high-priority processing task may preempt the processor resources of a low-priority processing task that is currently executing, performing a temporary task switch. When the high-priority processing task completes, the processor needs to resume the previous low-priority processing task. When the first processing task, as a low-priority processing task, is preempted by a high-priority processing task, it indicates that a context switch has occurred for the first processing task. In another example, processing tasks of equal priority are allocated time slices. When the time slice of a processing task expires, if the processing task has not completed, it may switch to another task of the same priority. When the time slice of the first processing task expires and it is preempted by another task of the same priority, it indicates that a context switch has occurred for the first processing task.

[0102] When a context switch occurs in the first processing task, it indicates that the first processing task is suspended. This means that the current timeframe is not during the execution of the first processing task, and therefore the general virtual address carrying the first generation identifier should be invalid at that moment. In this case, the processor can set the first generation identifier in the metadata of the first processing task to invalid, and restore its validity when the first processing task is rescheduled. This prevents the general virtual address from being misused while the first processing task is suspended. In one example, the processor can set the first generation identifier to unreadable, or set the validity flag of the first generation identifier to invalid.

[0103] In step S22, if the processor's storage space is reallocated or initialized, the first generation identifier in the metadata of the first processing task is updated.

[0104] When the processor undergoes a hardware reboot or virtual address space reconstruction, its memory space is reallocated. During this process, the virtual address spaces available to each processing task may change, and previously accessible virtual addresses may now exceed the redefined virtual address space. Therefore, in the event of memory space reallocation, the processor can update the first generation identifier in the metadata of the first processing task, effectively rebinding the first processing task to the first generation identifier. This can trigger the regeneration of a generic virtual address. It should be understood that the regenerated first generation identifier may be identical to the original, but the initial virtual address within the regenerated generic virtual address may have changed.

[0105] Similarly, when the processor's memory space is initialized, the first generation identifier in the metadata of the first processing task can be updated, thereby triggering the regeneration of the general virtual address.

[0106] As one implementation of this disclosure, dedicated processing logic is designed for scenarios such as task completion, task switching, and storage space reconstruction, thereby improving system fault tolerance.

[0107] According to the data access method of the present disclosure, the first processing task can be any one of the processing tasks such as image processing, voice processing, text processing, and video processing, and the present disclosure does not limit this.

[0108] The following describes the data access method provided in this embodiment, taking the first kernel function as the first processing task as an example.

[0109] When a new kernel function is started, the processor hardware calculates a generation identifier based on the kernel function's identifier (such as the Kernel ID). When generating a general-purpose virtual address within that kernel function, the processor's compiler obtains this generation identifier through instructions from the arithmetic unit and places it in the high-order address region of the general-purpose virtual address or in the address window of the initial virtual address to obtain the general-purpose virtual address.

[0110] During the memory access phase, in response to a memory access request, the processor's Load Store Unit (LSU) compares the generation identifier (i.e., the second generation identifier) ​​carried in the general virtual address with the generation identifier (i.e., the first generation identifier) ​​of the currently executing kernel function. If the two do not match, the processor can determine that the general virtual address is invalid. For invalid general virtual addresses, the processor hardware can prevent the memory access request from being submitted, generate an exception signal, or return a preset error result.

[0111] The memory access phase can be either the memory access request generation phase or the memory access request submission phase; this embodiment does not impose any restrictions on this.

[0112] In this way, by automatically comparing the generation identifier carried in the general virtual address with the generation identifier of the currently executed kernel function, the validity of the general virtual address can be determined, thus preventing the general virtual address from being misused across kernel functions.

[0113] In this embodiment, a generation identifier related to execution time is introduced for the general virtual address at the hardware level, clarifying the lifecycle boundary (i.e., the execution cycle of the second processing task). The generation identifier of the currently executing processing task is maintained in the hardware, enabling the hardware to automatically determine the legality of the general virtual address in the currently executing processing task and automatically invalidate the general virtual address when context switching or when the lifecycle ends. This effectively prevents illegal address use across processing tasks, across kernels, and across contexts, reducing debugging costs and system risks caused by useless addresses.

[0114] Figure 4 This is a schematic diagram of a processor provided in an embodiment of the present disclosure. (Refer to...) Figure 4 The processor includes a metadata storage unit, a processing unit, and a loading storage unit.

[0115] The data access method provided in this disclosure can be applied to... Figure 4 The processor shown. Taking the first kernel as the first processing task as an example, combined with... Figure 4 The processor shown illustrates the data storage method provided in the embodiments of this disclosure.

[0116] When the first kernel is generated, the processor hardware generates a first generation identifier based on the identifier of the first kernel and stores it in the metadata storage unit.

[0117] During the first Kernl execution, if an operation to obtain a general virtual address occurs, the processor's compiler will read the first generated identifier from the metadata storage unit through the instructions of the arithmetic unit and insert it into the final general virtual address.

[0118] During the execution of the first kernel, if an operation using a generic virtual address occurs, the LSU, after obtaining the generic virtual address, first checks whether the generation identifier (i.e., the second generation identifier) ​​carried in the generic virtual address matches the first generation identifier stored in the metadata storage unit. If they match, the LSU continues to perform the memory access operation; if they do not match, the LSU performs an exception operation.

[0119] According to the data access method provided in this disclosure, the availability range (i.e., lifecycle) of the general virtual address is distinguished by the generation identifier carried by the general virtual address. Hardware automatically determines whether the virtual general address is valid or invalid, replacing software conventions and stubbing checks. Therefore, the data access method provided in this disclosure can prevent dangling points, avoid using general virtual addresses generated in invalid contexts (including completed processing tasks or processing tasks suspended due to context switching); prevent out-of-bounds shared memory access, reducing debugging costs and system risks caused by address misuse; require no software instrumentation or additional instructions, all legality checks are automatically completed in hardware; and are transparent to existing programming models, requiring no modification to software interfaces or instruction set architecture (ISA) semantics.

[0120] The processors provided in this disclosure include, but are not limited to, graphics processors or other parallel processors that support a unified address model. These processors can manage the lifecycle of general virtual addresses, thereby ensuring the time validity of general virtual addresses.

[0121] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0122] In addition, this disclosure also provides data access devices, electronic devices, and computer-readable storage media, all of which can be used to implement any of the data access methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section, and will not be repeated here.

[0123] Figure 5 This is a block diagram of a data access device provided in an embodiment of the present disclosure.

[0124] Reference Figure 5 This disclosure provides a data memory access device applied to a processor, the data memory access device 50 including the following modules.

[0125] The first acquisition module 51 is used to obtain the general virtual address corresponding to the memory access request from the general address register of the processor in response to the memory access request of the first processing task currently being executed in the processor; the first processing task corresponds to the first generation identifier.

[0126] The second acquisition module 52 is used to acquire a second generated identifier from the general virtual address; the second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task.

[0127] The first execution module 53 is used to execute the memory access operation of the memory access request when the first generation identifier and the second generation identifier are the same.

[0128] In one possible implementation, the apparatus further includes: a first generation module, configured to generate a second generation identifier based on the identifier of the second processing task when the second processing task is started, and to store the second generation identifier in the metadata of the second processing task; a second generation module, configured to generate an initial virtual address based on a base address and an offset address in response to an operation of generating a general virtual address during the execution of the second processing task, and to obtain the second generation identifier from the metadata of the second processing task; a third generation module, configured to generate a general virtual address based on the initial virtual address and the second generation identifier; and a storage module, configured to store the general virtual address in a general address register.

[0129] In one possible implementation, the third generation module is specifically used to: write the second generation identifier into the address window of the initial virtual address to obtain a general virtual address.

[0130] In one possible implementation, the third generation module is specifically used to: determine the bit width of the general address register as the bit width of the general virtual address, wherein the bit width of the initial virtual address is smaller than the bit width of the general virtual address;

[0131] The initial virtual address is written into the low-order address area of ​​the general virtual address, and the second generation identifier is written into the address area of ​​the general virtual address excluding the low-order address area, thus obtaining the general virtual address. The bit width of the low-order address area is the same as the bit width of the initial virtual address.

[0132] In one possible implementation, the apparatus further includes a third acquisition module, configured to acquire a first generation identifier from the metadata of the first processing task in response to a memory access request.

[0133] In one possible implementation, the device further includes: a second execution module, configured to perform an abnormal operation if the first generated identifier and the second generated identifier are different; wherein the abnormal operation includes one or more of the following: blocking memory access requests; generating an abnormal signal; and returning a preset error result.

[0134] In one possible implementation, the apparatus further includes at least one of the following: a deletion module, configured to delete a first generation identifier from the metadata of the first processing task when the first processing task finishes execution; a setting module, configured to set the first generation identifier in the metadata of the first processing task to invalid when the first processing task undergoes a context switch; and an update module, configured to update the first generation identifier in the metadata of the first processing task when the processor's storage space is reallocated or initialized.

[0135] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.

[0136] Reference Figure 6 This disclosure provides an electronic device, which includes: at least one processor 701; at least one memory 702; and one or more I / O interfaces 703 connected between the processor 701 and the memory 702; wherein the memory 702 stores one or more computer programs that can be executed by the at least one processor 701, and the one or more computer programs are executed by the at least one processor 701 to enable the at least one processor 701 to perform the above-described data access method.

[0137] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements the data access method described above. The computer-readable storage medium may be volatile or non-volatile.

[0138] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described data access method.

[0139] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0140] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0141] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0142] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0143] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0144] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0145] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0146] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0148] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.

Claims

1. A data access method, characterized in that, Applied to a processor, the method includes: In response to a memory access request from a first processing task currently being executed in the processor, a general virtual address corresponding to the memory access request is obtained from the processor's general address register; the first processing task corresponds to a first generation identifier; the general virtual address includes a second generation identifier; the second generation identifier is valid throughout the entire execution cycle of the second processing task; the second generation identifier is generated by the processor based on the identifier of the second processing task when the second processing task is started, and is deleted by the processor when the second processing task is terminated; A second generated identifier is obtained from the general virtual address; the second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task. If the first generated identifier and the second generated identifier are the same, the memory access operation of the memory access request is executed.

2. The method according to claim 1, characterized in that, The method further includes: The second generation identifier is stored in the metadata of the second processing task; During the execution of the second processing task, in response to the operation of generating a general virtual address, an initial virtual address is generated based on the base address and offset address corresponding to the second processing task, and the second generation identifier is obtained from the metadata of the second processing task; The general virtual address is generated based on the initial virtual address and the second generation identifier; The general virtual address is stored in the general address register.

3. The method according to claim 2, characterized in that, The step of generating the generic virtual address based on the initial virtual address and the second generation identifier includes: The second generated identifier is written into the address window of the initial virtual address to obtain the general virtual address.

4. The method according to claim 2, characterized in that, The step of generating the generic virtual address based on the initial virtual address and the second generation identifier includes: The bit width of the general address register is determined to be the bit width of the general virtual address; the bit width of the initial virtual address is smaller than the bit width of the general virtual address; The initial virtual address is written into the low-order address area of ​​the general virtual address, and the second generation identifier is written into the address area of ​​the general virtual address other than the low-order address area to obtain the general virtual address; the bit width of the low-order address area is the same as the bit width of the initial virtual address.

5. The method according to claim 1, characterized in that, The method further includes: In response to the memory access request, the first generation identifier is obtained from the metadata of the first processing task.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: If the first generated identifier and the second generated identifier are different, an abnormal operation will be performed; The abnormal operation includes at least one of the following: Prevent the memory access request; Generate abnormal signals; Returns the default error result.

7. The method according to any one of claims 1-5, characterized in that, The method further includes at least one of the following: If the first processing task has finished executing, the first generation identifier is deleted from the metadata of the first processing task; In the event of a context switch in the first processing task, the first generation identifier in the metadata of the first processing task is set to invalid. In the event of a reallocation or initialization of the processor's storage space, the first generation identifier in the metadata of the first processing task is updated.

8. A data access device, characterized in that, Applied to a processor, the device includes: A first acquisition module is configured to, in response to a memory access request from a first processing task currently being executed in the processor, acquire a general virtual address corresponding to the memory access request from the processor's general address register; the first processing task corresponds to a first generation identifier; the general virtual address includes a second generation identifier; the second generation identifier is valid throughout the entire execution cycle of the second processing task; the second generation identifier is generated by the processor based on the identifier of the second processing task when the second processing task is started, and is deleted by the processor when the second processing task is terminated; The second acquisition module is used to acquire a second generated identifier from the general virtual address; the second generated identifier is used to indicate that the general virtual address is valid during the execution of the second processing task. The execution module is used to execute the memory access operation of the memory access request when the first generated identifier and the second generated identifier are the same.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the data memory access method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data access method as described in any one of claims 1-7.

11. A computer program product, characterized in that, Includes computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the data access method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Virtual Address Cache And Method For Sharing Data Using A Unique Task Identifier

    US20070294504A1