Apparatus and method for remote atomic floating point operations
Embodiments relate to atomic memory operations with floating point values. An example processor comprises: a control register to store rounding mode and denormal mode control bits to indicate a rounding mode and denormal value processing mode; fetch circuitry to fetch a remote atomic operation (RAO) floating point (FP) instruction comprising a memory location to store at least one FP result value; decode circuitry to decode the instruction and scheduling circuitry to offload the instruction to an execution engine external to the logical processor or to schedule the decoded instruction for local execution, wherein an indication of the rounding mode and denormal value processing mode is communicated to the execution engine, the indication to be communicated by a transfer of one or more of the rounding mode control bits and denormal mode control bits to a storage coupled to the execution engine, or to be communicated in the message.
1 . A processor, comprising:
a plurality of cores, each core of the plurality of cores including one or more logical processors, each logical processor comprising:
a control register to store rounding mode control bits and denormal mode control bits to indicate, to be used for floating-point operations, a rounding mode and denormal value processing mode of the logical processor;
hardware fetch circuitry to fetch a remote atomic operation (RAO) floating point (FP) instruction comprising an opcode indicating an FP math operation, at least one FP source value, and a memory location to store at least one FP result value;
hardware decode circuitry to decode the RAO FP instruction to produce a decoded RAO FP instruction comprising one or more microoperations; and
hardware scheduling circuitry to determine whether to offload the decoded RAO FP instruction to an execution engine external to the logical processor or to schedule the decoded RAO FP instruction for execution by execution circuitry of the logical processor,
wherein the hardware scheduling circuitry is to determine to offload the decoded RAO FP instruction to the execution engine, wherein to offload the decoded RAO FP instruction, the hardware scheduling circuitry is to transmit a message to the execution engine indicating the FP math operation associated with the decoded RAO FP instruction, the at least one FP source value, and the memory location to store the at least one FP result value, and
wherein the rounding mode control bits and the denormal mode control bits of the logical processor are to be communicated to the execution engine external to the logical processor in the message.
2 . The processor of claim 1 , wherein the hardware scheduling circuitry is to determine to offload the decoded RAO FP instruction to the execution engine based on a memory region associated with the memory location to store the at least one FP result value.
3 . The processor of claim 2 , wherein the execution engine external to each logical processor is associated with the memory region.
4 . The processor of claim 1 , wherein the rounding mode indicates one of: round-to-nearest rounding, round towards positive rounding, round towards negative rounding, and round towards zero rounding; and wherein the denormal value processing mode indicates one of: a denormals-are-zero mode and a flush-to-zero mode.
5 . The processor of claim 1 , wherein the RAO FP instruction is a single-instruction multiple data (SIMD) instruction to perform a plurality of instances of the FP math operation, wherein the at least one FP source value comprises a plurality of FP source values and the at least one FP result value comprises a corresponding plurality of FP result values, each FP source value of the plurality of FP source values and each respective FP result value of the corresponding plurality of FP result values associated with an instance of the plurality of instances of the FP math operation.
6 . The processor of claim 5 , wherein the FP math operation is an accumulation operation, wherein the execution engine is to generate each FP result value of the corresponding plurality of FP result values by adding an accumulated FP value to a corresponding FP source value to generate a corresponding FP result value of the corresponding plurality of FP result values.
7 . The processor of claim 6 , wherein each FP source value has an 8-bit FP format, a 16-bit FP format, a 32-bit FP format, or a 64-bit FP format.
8 . The processor of claim 6 , wherein each FP source value has an 8-bit FP format or a 16-bit FP format, and each respective FP result value has the 16-bit FP format or a 32-bit FP format.
9 . The processor of claim 1 wherein the execution engine is one of a plurality of execution engines external to each logical processor, wherein the hardware scheduling circuitry is to select the execution engine from the plurality of execution engines based on the memory location to store the at least one FP result value.
10 . The processor of claim 9 , wherein the execution engine is integral to a circuit block external to the logical processor, the circuit block associated with one of: a private cache or a shared cache, a cache control circuit, a memory controller, and a remote core.
11 . A method, comprising:
storing rounding mode control bits and denormal mode control bits in a control register of a logical processor of a core to indicate a-rounding mode and denormal value processing mode of the logical processor, respectively, to be used for floating-point operations;
fetching, by the logical processor, a remote atomic operation (RAO) floating point (FP) instruction comprising an opcode indicating an FP math operation, at least one FP source value, and a memory location to store at least one FP result value;
decoding, by the logical processor, the RAO FP instruction to produce a decoded RAO FP instruction comprising one or more microoperations;
determining whether to offload the decoded RAO FP instruction to an execution engine external to the logical processor or to execute the decoded RAO FP instruction by execution circuitry of the logical processor; and
determining to offload the decoded RAO FP instruction to the execution engine, wherein offloading the decoded RAO FP instruction includes transmitting a message to the execution engine indicating the FP math operation associated with the decoded RAO FP instruction, the at least one FP source value, and the memory location to store the at least one FP result value, and
wherein the rounding mode control bits and the denormal mode control bits of the logical processor are to be communicated to the execution engine external to the logical processor in the message.
12 . The method of claim 11 , wherein offloading the decoded RAO FP instruction is performed based on a memory region associated with the memory location to store the at least one FP result value.
13 . The method of claim 12 , wherein the execution engine external to the logical processor is associated with the memory region.
14 . The method of claim 11 , wherein the rounding mode indicates one of: round-to-nearest rounding, round towards positive rounding, round towards negative rounding, and round towards zero rounding; and wherein the denormal value processing mode indicates one of: a denormals-are-zero mode and a flush-to-zero mode.
15 . The method of claim 11 , wherein the RAO FP instruction is a single-instruction multiple data (SIMD) instruction to perform a plurality of instances of the FP math operation, wherein the at least one FP source value comprises a plurality of FP source values and the at least one FP result value comprises a corresponding plurality of FP result values, each FP source value of the plurality of FP source values and each respective FP result value of the corresponding plurality of FP result values corresponding to an instance of the plurality of instances of the FP math operation.
16 . The method of claim 15 , wherein the FP math operation is an accumulation operation, wherein the execution engine is to generate each FP result value of the corresponding plurality of FP result values by adding an accumulated FP value to a corresponding FP source value to generate a corresponding FP result value of the corresponding plurality of FP result values.
17 . The method of claim 16 , wherein each FP source value has an 8-bit FP format, a 16-bit FP format, a 32-bit FP format, or a 64-bit FP format.
18 . The method of claim 16 , wherein each FP source value has an 8-bit FP format or a 16-bit FP format, and each respective FP result value has the 16-bit FP format or a 32-bit FP format.
19 . The method of claim 11 , wherein the execution engine is one of a plurality of execution engines external to the logical processor, wherein the execution engine is selected from the plurality of execution engines based on the memory location to store the at least one FP result value.
20 . A non-transitory machine-readable medium having program code stored thereon which, when executed by a machine, causes the machine to perform operations comprising:
storing rounding mode control bits and denormal mode control bits in a control register of a logical processor of a core to indicate a rounding mode and denormal value processing mode of the logical processor, respectively, to be used for floating-point operations;
fetching, by the logical processor, a remote atomic operation (RAO) floating point (FP) instruction comprising an opcode indicating an FP math operation, at least one FP source value, and a memory location to store at least one FP result value;
decoding, by the logical processor, the RAO FP instruction to produce a decoded RAO FP instruction comprising one or more microoperations;
determining whether to offload the decoded RAO FP instruction to an execution engine external to the logical processor or to execute the decoded RAO FP instruction by execution circuitry of the logical processor; and
determining to offload the decoded RAO FP instruction to the execution engine, wherein offloading the decoded RAO FP instruction includes transmitting a message to the execution engine indicating the FP math operation associated with the decoded RAO FP instruction, the at least one FP source value, and the memory location to store the at least one FP result value, and
wherein the rounding mode control bits and the denormal mode control bits of the logical processor are to be communicated to the execution engine external to the logical processor in the message.