Information processing device, information processing method, and recording medium
The information processing device addresses the challenge of executing programs with different libraries by using a compatibility library with proxy types and automatic data format conversion, enabling efficient and simplified execution and debugging.
Patent Information
- Application Number
- PCT/JP2023/028250
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2025-02-06
AI Technical Summary
Existing information processing systems face challenges in seamlessly executing programs that use different libraries, particularly when data types defined in one library are not specified in another, requiring explicit switching between libraries, which complicates processing and debugging.
The information processing device employs a compatibility library that defines proxy types for data types present in one library but not in another, allowing execution without explicit switching by using a third library for data types not specified in the second library, and converting data formats as needed between libraries.
This approach enables seamless execution of programs using different libraries without explicit switching, simplifying the processing flow and facilitating easier debugging by layering libraries and converting data formats automatically, thus improving efficiency and reducing complexity.
Smart Images

Figure JP2023028250_06022025_PF_FP_ABST
Abstract
Description
Information processing device, information processing method, and recording medium
[0001] The present invention relates to an information processing device, an information processing method, and a recording medium.
[0002] When compiling a program, an intermediate representation of the program may be generated, and a library may be used in the intermediate representation (see, for example, Patent Document 1).
[0003] Japanese Patent Application Laid-Open No. 2000-132403
[0004] It is conceivable that different libraries are used for the source program and the intermediate representation, and that the data types used in the source program library (the library used in the source program) are not defined in the intermediate representation library (the library used in the intermediate representation). In such a case, the part of the source program that uses data types not defined in the intermediate representation library can be executed using the source program library, and the part that uses only data types defined in the intermediate representation library can be converted into an intermediate representation and executed using the intermediate representation library.
[0005] In this way, when using different libraries for different parts of a program, it is preferable to be able to execute each part of the program without having to explicitly switch the library to be used, even if the defined data types differ depending on the library.
[0006] An example of an object of the present invention is to provide an information processing device, an information processing method, and a recording medium that can solve the above-mentioned problems.
[0007] According to a first aspect of the present invention, an information processing device comprises: a program execution means for executing a program using a third library in which a data type that is defined in a first library but not in a second library is defined as a data type for processing using the first library; a second library application processing means for, in executing the program, performing processing using only data of the data type defined in the second library using the second library; and a first library application processing means for, in executing the program, performing processing using data of the data type for processing using the first library using the first library.
[0008] According to a second aspect of the present invention, an information processing method includes a computer executing a program using a third library in which a data type that is defined in a first library but not in a second library is defined as a data type for processing using the first library, and in executing the program, processing using only data of the data type defined in the second library is performed using the second library, and in executing the program, processing using data of the data type for processing using the first library is performed using the first library.
[0009] According to a third aspect of the present invention, a recording medium is a recording medium on which a program is recorded, which causes a computer to execute a program using a third library in which a data type that is defined in a first library but not in a second library is defined as a data type for processing using the first library, and in executing the program, causes the second library to perform processing using only data of the data type defined in the second library, and in executing the program, causes the first library to perform processing using data of the data type for processing using the first library.
[0010] According to the present invention, when different libraries are used depending on the part of a program, even if the defined data types differ depending on the library, each part of the program can be executed without having to explicitly switch the library to be used.
[0011] FIG. 1 is a diagram showing an example of the configuration of an information processing device according to at least one embodiment; FIG. 2 is a diagram showing an example of the definition of a "Matrix" class, which is a class of matrices in a compatible library according to at least one embodiment; FIG. 3 is a diagram showing an example of the definition of a "Vector" class, which is a class of vectors in a compatible library according to at least one embodiment; FIG. 4 is a diagram showing an example of a source program using matrix types and vector types in a compatible library according to at least one embodiment; FIG. 5 is a diagram showing another example of the definition of a "Matrix" class in a compatible library according to at least one embodiment; FIG. 6 is a diagram showing an example of data input / output in each unit of a control unit according to at least one embodiment; FIG. 7 is a diagram showing another example of the configuration of an information processing device according to at least one embodiment; FIG. 8 is a diagram showing an example of a processing procedure in an information processing method according to at least one embodiment; and FIG. 9 is a schematic block diagram showing the configuration of a computer according to at least one embodiment.
[0012] The following describes embodiments of the present invention, but the following embodiments do not limit the scope of the invention as claimed. Furthermore, not all of the combinations of features described in the embodiments are necessarily essential to the solution of the invention.
[0013] <First Embodiment> Fig. 1 is a diagram showing an example of the configuration of an information processing device according to at least one embodiment. In the configuration shown in Fig. 1, the information processing device 100 includes a communication unit 110, a display unit 120, an operation input unit 130, a storage unit 180, and a control unit 190. The control unit 190 includes a front-end unit 210, an intermediate unit 220, and a back-end unit 230. The front-end unit 210 includes a program execution unit 211, an intermediate representation generation unit 212, a data conversion unit 213, and a parent library application processing unit 214. The intermediate unit 220 includes an optimization unit 221. The back-end unit 230 includes an intermediate representation execution unit 231.
[0014] The information processing device 100 partially converts a source program, which is a program to be executed such as a user program, into an intermediate representation and executes the converted source program. The information processing device 100 may also operate as a just-in-time compiler and partially convert the source program into an intermediate representation and execute the converted source program. The source program portion is also referred to as the source program. The source program is also simply referred to as the program.
[0015] Converting a source program into an intermediate representation is also referred to as “creating an intermediate representation” or “generating an intermediate representation.” The information processing device 100 may be configured using a computer such as a personal computer (PC).
[0016] The communication unit 110 communicates with other devices. For example, the communication unit 110 may communicate with another computer, such as a user's terminal device, to receive the source program. However, the method by which the information processing device 100 acquires the source program is not limited to a specific method.
[0017] The display unit 120 has a display screen such as a liquid crystal panel or an LED (Light Emitting Diode) panel, and acquires various images. For example, the display unit 120 may display the intermediate representation in accordance with a user instruction.
[0018] The operation input unit 130 includes input devices such as a keyboard and a mouse, and accepts user operations. For example, the operation input unit 130 may accept a user operation to instruct execution of a source program. Alternatively, the operation input unit 130 may accept a user operation to instruct display of an intermediate representation, and as described above, the display unit 120 may display the intermediate representation in accordance with the user's instruction.
[0019] The storage unit 180 stores various types of data. For example, the storage unit 180 may store a source program and an intermediate representation. The storage unit 180 is configured using a storage device included in the information processing device 100.
[0020] The control unit 190 controls each unit of the information processing device 100 to perform various processes. In particular, the control unit 190 executes a source program. As described above with respect to the information processing device 100, the control unit 190 partially converts the source program into an intermediate representation and executes it. The functions of the control unit 190 are performed, for example, by a CPU (Central Processing Unit) included in the information processing device 100 reading out a program from the storage unit 180 and executing it.
[0021] The front-end unit 210 converts part of the source program into an intermediate representation for the back-end unit 230, and causes the obtained intermediate representation to be executed by the back-end unit 230. Furthermore, the front-end unit 210 executes the part of the source program that is not converted into the intermediate representation as the source program.
[0022] Here, "executing as a source program" means executing without converting it into an intermediate representation for the backend unit 230. In particular, the expression "executing as a source program" does not exclude the case where a source program is converted into an intermediate representation in an intermediate language other than the intermediate language for the backend unit 230 and then executed. The intermediate language for the backend unit 230 is also simply referred to as the intermediate language. The intermediate representation for the backend unit 230 is also simply referred to as the intermediate representation.
[0023] The program execution unit 211 executes a source program. Specifically, the program execution unit 211 executes a source program written to use a parent library by using a compatible library that is compatible with the parent library. The program execution unit 211 is an example of a program execution means.
[0024] The parent library is a library that supports the programming language of the source program. The compatible library is a library that is compatible with the parent library in terms of the source program description and is designed to allow the backend (backend unit 230) to execute the parts of the source program that can be executed in the backend.
[0025] A library used by the backend to perform operations is called a child library. A parent library is an example of a first library. A child library is an example of a second library. A compatible library is an example of a third library.
[0026] The program execution unit 211 executes the source program using the compatible library, thereby distinguishing between a portion of the source program that is executed as is and a portion that is converted into an intermediate representation and then executed.
[0027] Specifically, in the compatibility library, among the methods executed in the source program, the method that is converted into an intermediate representation and executed is defined to execute a method of the child library. The method here refers to a method in object-oriented programming (a procedure (a group of operations such as a function or subroutine) contained in an object).
[0028] The program execution unit 211 executes a method in the compatibility library, causing the intermediate representation generation unit 212 to generate an intermediate representation of a portion of the source program that is to be converted into an intermediate representation and executed. The program execution unit 211 also causes the intermediate representation execution unit 231 to execute the intermediate representation. For example, in the case of runtime compilation, the program execution unit 211 causes the back-end unit 230 to execute the intermediate representation when an instruction involving evaluation (value acquisition), such as a "print" instruction, is executed during source program execution, and it becomes necessary to execute the intermediate representation.
[0029] In addition, in the compatible library, among the methods executed in the source program, the methods that are executed as the source program as is are defined to execute the methods of the parent library. The program execution unit 211 executes the methods in the compatible library, thereby causing the parent library application processing unit 214 to execute the parts of the source program that are executed as the source program as is.
[0030] In this way, the distinction between the parts of the source program that are executed as is and the parts that are converted into an intermediate representation and executed, and the processing for each part, are built into the definition of the methods in the compatibility library. This allows the program execution unit 211 to have the intermediate representation execution unit 231 and the parent library application processing unit 214 process each part without having to explicitly distinguish between the parts that are executed as is and the parts that are converted into an intermediate representation and executed.
[0031] The intermediate representation generation unit 212 converts a portion of the source program into an intermediate representation (an intermediate representation intended for the back-end unit 230). Specifically, the intermediate representation generation unit 212 converts into the intermediate representation the portion of the source program that is assigned to be converted into the intermediate representation and executed by the program execution unit 211.
[0032] The data conversion unit 213 converts the representation format of data sent from the program execution unit 211 to the parent library application processing unit 214, and converts the representation format of data sent from the parent library application processing unit 214 to the program execution unit 211. The data conversion unit 213 is an example of a data conversion means.
[0033] Specifically, when a compatible library and a parent library have the same data type but different data representation formats, the data conversion unit 213 converts the data representation format of the data of that data type. For example, consider a case where, for a matrix type, the parent library shows a header indicating information such as the number of rows and columns, followed by the value of each element, while the compatible library shows a footer indicating information such as the number of rows and columns, followed by the value of each element.
[0034] In this case, when matrix-type data is transferred from the program execution unit 211 to the parent library application processing unit 214, the data conversion unit 213 converts the data representation format in the compatible library, in which a footer is shown after the value of each element, to the data representation format in the parent library, in which the value of each element is shown after the header.
[0035] In addition, when matrix-type data is transferred from the parent library application processing unit 214 to the program execution unit 211, the data conversion unit 213 converts the data representation format of the parent library, in which the value of each element is shown after the header, into the data representation format of the compatible library, in which a footer is shown after the value of each element.
[0036] On the other hand, for data types defined in the child library, the compatible library may use the data representation format of the child library, which eliminates the need to convert the data representation format when transferring data between the program execution unit 211 and the intermediate representation generation unit 212 or the intermediate representation execution unit 231.
[0037] The parent library application processor 214 uses a parent library to execute the portion of the source program that is assigned to be executed as is by the program execution unit 211. The parent library application processor 214 is an example of a first library application processing means.
[0038] The intermediate unit 220 performs processing between the generation of an intermediate representation by the front-end unit 210, and between an execution command for the intermediate representation and the execution of the intermediate representation by the back-end unit 230. The optimization unit 221 optimizes the intermediate representation generated by the intermediate representation generation unit 212. For example, when the intermediate representation generation unit 212 generates an intermediate representation specialized for a specific domain such as matrix operation, the optimization unit 221 may optimize the intermediate representation based on knowledge specific to that domain. Here, optimization of the intermediate representation may also mean converting the intermediate representation so that the back-end unit 230 can execute the intermediate representation faster.
[0039] The intermediate representation is executed by the back-end unit 230. The functions of the back-end unit 230 may be executed using hardware separate from the hardware that executes the functions of the front-end unit 210.
[0040] For example, the information processing device 100 may include an accelerator such as a GPU (Graphics Processing Unit) in addition to a CPU, and the functions of the control unit 190 may be executed using the accelerator in addition to the CPU. The functions of the front-end unit 210 may be executed using the CPU, and the functions of the back-end unit 230 may be executed using an accelerator such as a GPU. Furthermore, for example, the control unit 190 may convert a portion of the source program that can be executed by a GPU into an intermediate representation for a GPU and execute it on the GPU, and the remaining portion may be executed as the source program on the CPU.
[0041] Furthermore, the programming languages of the parent library and the source program may be ones that provide a relatively wide variety of operations, etc., to make it easier for users to write source programs (user programs). On the other hand, the programming languages of the child library and the intermediate representation (intermediate language) may be ones that provide fewer operations, etc., but are executable at high speeds, compared to the execution of the source program. For example, the programming languages of the child library and the intermediate representation may be domain-specific languages (DSLs) specialized for devices that execute the intermediate representation, such as GPUs. Regarding data types, the parent library may also provide a wider variety of data types than the child library.
[0042] The intermediate representation execution unit 231 executes the intermediate representation generated by the intermediate representation generation unit 212 or the intermediate representation optimized by the optimization unit 221 in accordance with an instruction from the program execution unit 211. That is, if the intermediate representation for which the intermediate representation instruction was received from the program execution unit 211 has been optimized by the optimization unit 221, the intermediate representation execution unit 231 executes the optimized intermediate representation. Furthermore, if the intermediate representation for which the intermediate representation instruction was received from the program execution unit 211 has not been optimized by the optimization unit 221, the intermediate representation execution unit 231 executes the intermediate representation generated by the intermediate representation execution unit 231. The intermediate representation execution unit 231 corresponds to an example of second library application processing means. The intermediate representation execution unit 231 outputs the execution result of the intermediate representation (the value obtained by executing the intermediate representation) to the program execution unit 211.
[0043] However, the configuration and functions of the information processing device 100 are not limited to a specific one, and various configurations and functions are possible, such as executing a program using multiple libraries with different defined data types.
[0044] In the following, we will assume that the parent library defines a vector type but the child library does not, and that both the parent and child libraries define a matrix type, but the matrix data representation formats are different between the parent and child libraries.
[0045] Furthermore, the compatibility library defines data types that are defined in the child library and data types that are not defined in the child library but are defined in the parent library. Regarding data types that are not defined in the child library but are defined in the parent library, the data types defined in the compatibility library are also called proxy types. Proxy types can be considered as data types defined for execution in the parent library.
[0046] The data representation format of the proxy-type data may be the same as the data representation format of the parent library. This allows the program execution unit 211, when acquiring data of a data type that is not defined in the child library but is defined in the parent library, to treat the data as it is as data from a compatible library without having to convert the data representation format.
[0047] However, the proxy types in the compatible library are not limited to vector types, and various data types that are defined in the parent library but not in the child library can be defined.
[0048] Figure 2 shows an example definition of the "Matrix" class, which is a matrix class in the compatible library. The class here is a class in object-oriented programming (equivalent to a blueprint for generating an object instance). The instance here is an instance in object-oriented programming (the actual object).
[0049] Part (A) of Figure 2 shows an example of the definition of the "column" method for a matrix in the compatible library. The variable "self" is a variable that indicates the instance. The variable "no" is a variable that indicates the column number (which column) in the matrix. The value of the variable "no" is given as an argument when the "column" method is called.
[0050] "parent_matrix = convert(self.matrix)" converts the matrix represented by the member variable "matrix" from the compatible library's matrix representation format to the parent library's matrix representation format, and assigns it to the variable "parent_matrix." The member variable here is an object-oriented member variable (a variable contained within an object).
[0051] The conversion from data in the matrix data representation format of the compatible library to data in the matrix data representation format of the parent library is performed using the "convert" function defined in the compatible library. When the "column" method of the compatible library is executed, the data conversion unit 213 converts data in the matrix data representation format of the compatible library to data in the matrix data representation format of the parent library.
[0052] "parent_column = parent_matrix.column(no)" indicates that the vector extracted from the column with the number indicated by the variable "no" of the matrix indicated by the variable "parent_matrix" (an instance of the matrix indicated by the variable "parent_matrix") is assigned to the variable "parent_column." Columns are extracted from a matrix using the "column" method defined in the parent library. When the "column" method of the compatible library is executed, the parent library application processing unit 214 executes the "column" method defined in the parent library.
[0053] "return Vector(parent_column)" indicates that the vector assigned to the variable "parent_column" is returned to the caller of the "column" method. When the "column" method of the compatible library is executed, the parent library application processing unit 214 outputs the vector assigned to the variable "parent_column" to the program execution unit 211.
[0054] Figure 3 shows an example of the definition of the "Vector" class, which is a vector class in the compatible library. Part (B) of Figure 3 shows an example of the initialization definition when a "Vector" instance is created. A "Vector" instance is an instance of a vector.
[0055] Here again, the variable "self" is the variable to which the instance is assigned. The variable "parant_obj" is a variable that indicates a vector (a variable that indicates an instance of a vector). The value of the variable "parant_obj" is given as an argument when creating a "Vector" instance.
[0056] "self.parent_obj = parent_obj" indicates that the vector assigned to the variable "parent_obj" is assigned to the member variable "parent_obj." When a "Vector" instance is generated, the program execution unit 211 performs the process shown in part (B) of FIG.
[0057] Part (C) of Figure 3 shows an example of the definition of the "add" method for a vector in the compatible library. Here again, the variable "self" is the variable to which an instance is assigned. The variable "rhs" is the variable to which a vector is assigned. The value of the variable "rhs" is given as an argument when the "add" method is called.
[0058] "v = self.parent_obj.add(rhs.parentg_obj)" indicates that the vector indicated by the member variable "parent_obj" of the "Vector" instance indicated by the variable "self" is added to the vector indicated by the member variable "parent_obj" of the "Vector" instance indicated by the variable "rhs", and the result is assigned to the variable "v". The vector addition is performed using the "add" method defined in the parent library. When the "add" method of the compatible library is executed, the parent library application processing unit 214 performs the vector addition using the "add" method defined in the parent library.
[0059] "return Vector(v)" indicates that the vector assigned to the variable "v" is returned to the caller of the "add" method. When the "add" method of the compatible library is executed, the parent library application processing unit 214 outputs the vector assigned to the variable "v" to the program execution unit 211.
[0060] Part (D) of Figure 3 shows an example of the definition of the "append" method for a vector in the compatible library. Here again, the variable "self" is the variable to which an instance is assigned. Here again, the variable "rhs" is the variable to which a vector is assigned. The value of the variable "rhs" is given as an argument when the "append" method is called.
[0061] "m = self.parent_obj.append(rhs.parent_obj)" indicates that a two-column matrix is generated by adding the vector indicated by the member variable "parent_obj" of the "Vector" instance indicated by the variable "rhs" to the vector indicated by the member variable "parent_obj" of the "Vector" instance indicated by the variable "self", and assigning this to the variable "m". The generation of a matrix by appending vectors is performed using the "append" method defined in the parent library. When the "append" method of the compatible library is executed, the parent library application processing unit 214 appends the vector to the vector using the "append" method defined in the parent library.
[0062] "return Matrix(m)" indicates that the matrix assigned to the variable "m" is converted into a matrix in the matrix-type data representation format of the compatible library and returned to the caller of the "append" method. When the "append" method of the compatible library is executed, the parent library application processing unit 214 outputs the matrix assigned to the variable "m" to the program execution unit 211 via the data conversion unit 213. The data conversion unit 213 converts from the matrix-type data representation format of the parent library to the matrix-type data representation format of the compatible library.
[0063] Figure 4 shows an example of a source program that uses matrix and vector types. "m2 = m0.add(m1)" adds the matrix instance "m0" and the matrix instance "m1" in the compatible library, and assigns the result to the matrix instance "m2." The matrix addition is performed in the backend based on the "add" method defined in the compatible library.
[0064] Specifically, the program execution unit 211 executes the "add" method of a matrix defined in the compatibility library, and in the execution of the "add" method, the intermediate representation generation unit 212 generates an intermediate representation of matrix addition. Furthermore, when the program execution unit 211 needs the value of instance "m2" in the execution of the source program, it requests the intermediate representation execution unit 231 to execute the intermediate representation. In response to the request from the program execution unit 211, the intermediate representation execution unit 231 executes the intermediate representation to calculate the value of instance "m2" and outputs it to the program execution unit 211.
[0065] "col0 = m2.column(0)" extracts the 0th column from the matrix instance "m2" and assigns it to the vector instance "col0". Extracting a column from a matrix is performed by fallback using the "column" method shown in Figure 2. The fallback here is to execute a compatible library by executing the parent library.
[0066] Specifically, the program execution unit 211 executes the "column" method of the compatible library to call the "column" method of the parent library. The parent library application processing unit 214 executes the "column" method of the parent library and outputs a vector of the execution result to the program execution unit 211.
[0067] In "col1 = col0.add(col0)", the vector instance "col0" and the vector instance "col0" are added together and assigned to the vector instance "col1". Addition between vectors is performed as a fallback using the "add" method shown in Figure 3.
[0068] Specifically, the program execution unit 211 executes the "add" method of the compatible library to call the "add" method of the parent library. The parent library application processing unit 214 executes the "add" method of the parent library and outputs a vector of the execution result to the program execution unit 211.
[0069] "m3 = col0.append(col1)" creates a two-column matrix by adding vector instance "col1" to vector instance "col0" and assigns it to matrix instance "m3." The generation of a matrix by appending vectors is performed as a fallback using the "append" method shown in Figure 3, and the resulting matrix is converted into a matrix in the matrix data representation format of the compatible library.
[0070] Specifically, the program execution unit 211 executes the "append" method of the compatible library to call the "append" method of the parent library. The parent library application processing unit 214 executes the "append" method of the parent library and outputs the matrix resulting from the execution to the program execution unit 211 via the data conversion unit 213. The data conversion unit 213 converts the data representation format of the matrix output by the parent library application processing unit 214 from the matrix-type data representation format of the parent library to the matrix-type data representation format of the compatible library, and outputs the converted data to the program execution unit 211.
[0071] "m4 = m3.add(m3)" adds the matrix instance "m3" in the compatible library to the matrix instance "m3" and assigns the result to the matrix instance "m4". The matrix addition is performed in the backend based on the "add" method defined in the compatible library.
[0072] Specifically, the program execution unit 211 executes the "add" method of a matrix defined in the compatibility library, and in the execution of the "add" method, the intermediate representation generation unit 212 generates an intermediate representation of matrix addition. Furthermore, when the program execution unit 211 needs the value of instance "m4" in the execution of the source program, it requests the intermediate representation execution unit 231 to execute the intermediate representation. In response to the request from the program execution unit 211, the intermediate representation execution unit 231 executes the intermediate representation to calculate the value of instance "m4", and outputs the value to the program execution unit 211.
[0073] Consider a case where only data types defined in the child library are defined in the compatible library. In this case, the information processing device 100 must use the parent library for processing data types not defined in the compatible library. Therefore, the program execution unit 211 must explicitly switch between using the compatible library and using the parent library.
[0074] In contrast to this, as described above, data types that are defined in the parent library but not in the child library are defined in the compatible library as proxy types, so that processing using the parent library and processing using the child library (processing in the backend section 230) can be specified within the processing in the compatible library.
[0075] In this respect, the information processing device 100 allows libraries to be hierarchized, which simplifies the configuration of the information processing device 100 compared to when the program execution unit 211 explicitly switches between using a compatible library and using a parent library. Furthermore, the information processing device 100 is expected to simplify the processing flow and make debugging relatively easy by using hierarchical libraries.
[0076] Consider a case where a matrix generated using a parent library in a process using a compatible library is returned as the execution result of a procedure in the compatible library in the matrix data representation format of the parent library. In this case, the execution result of the compatible library cannot be used as is in the process using the child library (processing in the back-end unit 230).
[0077] For example, consider the case where a matrix in the matrix-type data representation format of the parent library is assigned to the variable "m3" in "m3 = col0.append(col1)" in Figure 4. In this case, if the matrix-type data representation format of the parent library remains unchanged, "m4 = m3.add(m3)" cannot be executed using the child library. In this case, "m4 = m3.add(m3)" must be executed using the parent library, or the program execution unit 211 must convert the data representation format from the matrix type of the parent library to the matrix type of the child library separately from the processing using the parent library.
[0078] In contrast, in the information processing device 100, for a type whose data representation format differs between the parent library and the child library, such as "return Matrix(m)" in the example of Fig. 3, the data representation format in the parent library is converted to the data representation format in the compatible library (data representation format in the child library) during processing in the compatible library. As a result, in the information processing device 100, the back-end unit 230 can perform processing using the child library without the program execution unit 211 having to separately convert the data representation format.
[0079] In this respect, too, the information processing device 100 can simplify the configuration of the information processing device 100 compared to when the program execution unit 211 converts the data representation format separately from the processing using the compatible library. Furthermore, the information processing device 100 is expected to simplify the processing flow and make debugging relatively easier compared to when the program execution unit 211 converts the data representation format separately from the processing using the compatible library.
[0080] In a compatible library, instead of defining proxy types for individual data types such as vector types, a generic proxy type common to specific data types may be defined.
[0081] FIG. 5 is a diagram showing another example of the definition of the "Matrix" class in the compatible library. FIG. 5 shows an example of the definition of the "Matrix" class in the compatible library when a generic proxy type is specified. Comparing the example in FIG. 5 with the example in FIG. 2, the bottom line of the example in FIG. 2 reads "return Vector(parent_column)," whereas the bottom line of the example in FIG. 5 reads "return Proxy(parent_column)." In other respects, the example in FIG. 5 is the same as the case in FIG. 2. "Proxy" indicates a generic proxy type.
[0082] For example, the data conversion unit 213 may store a conversion table between the data types of the parent library and the compatible library in advance, and convert the data representation format between the data type in the parent library and the data type in the compatible library based on this conversion table.The data conversion unit 213 may then convert a data type that is not listed in the conversion table to a generic proxy type.This allows the information processing device 100 to handle data of a data type that is not defined in the child library but is defined in the parent library in the compatible library without having to individually define a proxy type for that data type.
[0083] 6 is a diagram showing an example of data input / output between each unit of the control unit 190. In the example of Fig. 6, the program execution unit 211 acquires and executes a source program. The program execution unit 211 executes a source program that is written to use a parent library, using a compatible library that is compatible with the parent library.
[0084] When a procedure in a child library is called during execution of a source program using a compatible library, the program execution unit 211 outputs the procedure call to the intermediate representation generation unit 212. In this case, the compatible library and the child library have the same data representation format, and the program execution unit 211 can output data of the data type of the child library to the intermediate representation generation unit 212 by outputting data of the data type of the compatible library as an argument of the procedure call. Data of the data type of the compatible library is also referred to as compatible library type data. Data of the data type of the child library is also referred to as child library type data.
[0085] The intermediate representation generation unit 212 generates an intermediate representation in response to a procedure call output from the program execution unit 211. The intermediate representation generation unit 212 generates an intermediate representation so that the generated intermediate representation can be executed using a child library.
[0086] The optimization unit 221 optimizes the intermediate representation generated by the intermediate representation generation unit 212. For example, as described above, the optimization unit 221 performs optimization on the intermediate representation based on domain-specific knowledge. The optimization unit 221 optimizes the intermediate representation so that the optimized intermediate representation can be executed using the child library.
[0087] Furthermore, when the program execution unit 211 needs to execute an intermediate representation when executing an instruction involving evaluation during source program execution, it presents data whose value is required to the intermediate representation execution unit 231 and requests that the intermediate representation be executed. The intermediate representation execution unit 231 selects an intermediate representation in response to the request from the program execution unit 211 and executes the selected intermediate representation. The intermediate representation execution unit 231 executes the intermediate representation using a child library.
[0088] The intermediate representation execution unit 231 outputs the execution result of the intermediate representation as child library type data to the program execution unit 211. The compatible library and the child library have the same data representation format, and the program execution unit 211 can handle the execution result of the intermediate representation as compatible library data.
[0089] When a procedure in a parent library is called during execution of a source program using a compatible library, the program execution unit 211 outputs the procedure call to the parent library application processing unit 214 via the data conversion unit 213. In this case, the program execution unit 211 outputs data of a data type defined in the child library among the arguments of the procedure call as child library type data. Furthermore, the program execution unit 211 outputs data of a data type not defined in the child library among the arguments of the procedure call as proxy type data.
[0090] Data conversion unit 213 converts, as necessary, the data representation format of arguments of a procedure call output from program execution unit 211. Specifically, data conversion unit 213 converts data of a data type that is defined in both the parent library and the child library and has different data representation formats between the parent library and the child library, from the data representation format in the child library to the data representation format in the parent library.
[0091] On the other hand, the proxy-type data representation format in the compatible library is the same as the data representation format of the data type in the parent library. Therefore, the data conversion unit 213 outputs the proxy-type data as is to the parent library application processing unit 214 without converting the data representation format. By this data conversion, the data conversion unit 213 outputs the procedure call output by the program execution unit 211 to the parent library application processing unit 214 using the parent library type data as an argument.
[0092] The parent library application processor 214 calls a procedure in the parent library in accordance with the procedure call obtained from the program execution unit 211 via the data conversion unit 213. Then, the parent library application processor 214 outputs the procedure execution result to the program execution unit 211 via the data conversion unit 213. The parent library application processor 214 outputs the procedure execution result as parent library type data.
[0093] The data conversion unit 213 converts, as necessary, the data representation format of the procedure execution results output by the parent library application processing unit 214. Specifically, the data conversion unit 213 converts data of a data type that is defined in both the parent library and the child library and has different data representation formats in the parent library and the child library, from the data representation format in the parent library to the data representation format in the child library.
[0094] On the other hand, data of a data type that is defined in the parent library but not in the child library is treated as proxy-type data in the compatible library in its original data representation format. Therefore, the data conversion unit 213 outputs data of a data type that is defined in the parent library but not in the child library to the program execution unit 211 as is without converting the data representation format.
[0095] Through this data conversion, the data conversion unit 213 outputs the procedure execution result output by the parent library application processing unit 214 to the program execution unit 211 as data of the data type in the compatible library. The data type in the compatible library is the data type in the child library or a proxy type. The program execution unit 211 outputs the execution result of the source program by executing the output command of the source program.
[0096] As described above, the program execution unit 211 executes a source program using a compatible library in which data types that are defined in the parent library but not in the child library are defined as proxy types, which are data types for performing processing using the parent library. The intermediate representation execution unit 231 uses the child library to perform processing that uses only data of the data type defined in the child library when executing the source program. The parent library application processing unit 214 uses the parent library to perform processing that uses data of the data type for performing processing using the parent library when executing the source program.
[0097] According to the information processing device 100, data types that are defined in the parent library but not in the child library are defined as proxy types in the compatible library, so that processing using data of a data type that is not defined in the child library can also be performed using the compatible library.
[0098] In this way, when the information processing device 100 uses different libraries depending on the part of the program, each part of the program can be executed without having to explicitly switch the library to be used, even if the defined data types differ depending on the library.
[0099] This allows the information processing device 100 to execute a source program using either the parent library or the child library depending on the part of the source program, without the need to make any changes to the source program that is written to use the parent library.
[0100] Furthermore, in the information processing device 100, libraries can be organized into layers, such that a method of a parent library and a method of a child library are called from a method of a compatible library, which simplifies the configuration of the information processing device 100 compared to when the program execution unit 211 explicitly switches the library to be used. Furthermore, with the information processing device 100, the hierarchical organization of libraries simplifies the processing flow, and it is expected that debugging will be relatively easy.
[0101] The intermediate representation generation unit 212 generates an intermediate representation of a process that uses only data of a data type defined in the child library. The intermediate representation execution unit 231 executes the intermediate representation generated by the intermediate representation generation unit 212.
[0102] According to the information processing device 100, each part of a source program can be executed without the need to explicitly switch between executing the source program using a library (parent library) used in the source program and converting the source program into an intermediate representation and executing the intermediate representation into which the source program has been converted using a library (child library) used in the intermediate representation.
[0103] In addition, the data conversion unit 213 converts data obtained by processing using a parent library and whose data expression format differs between the parent library and the child library from the data expression format in the parent library to the data expression format in the child library.
[0104] According to the information processing device 100, the program execution unit 211 can perform processing using a child library without having to separately convert the data representation format. In this respect, too, the information processing device 100 can simplify the configuration of the information processing device 100 compared to when the program execution unit 211 converts the data representation format separately from processing using a compatible library. Furthermore, according to the information processing device 100, the processing flow is simplified compared to when the program execution unit 211 converts the data representation format separately from processing using a compatible library, and it is expected that debugging will be relatively easy.
[0105] Furthermore, the data type for processing using the parent library is defined in the generic library as a generic proxy type that is common to multiple data types defined in the parent library. The program execution unit 211 treats data obtained using the parent library that has a data type defined in the parent library but not defined in the child library as generic proxy type data. The parent library application processing unit 214 performs processing using the generic proxy type data using the parent library, treating the generic proxy type data as data of the data type in the parent library.
[0106] According to the information processing device 100, data of a data type that is not defined in a child library but is defined in a parent library can be handled in a compatible library without the need to define a proxy type for each data type.
[0107] 7 is a diagram showing another example of the configuration of an information processing device according to at least one embodiment. In the configuration shown in Fig. 7, an information processing device 610 includes a program execution unit 611, a second library application processing unit 612, and a first library application processing unit 613.
[0108] With this configuration, the program execution unit 611 executes the program using a third library in which a data type defined in the first library but not in the second library is defined as a data type for processing using the first library. The second library application processing unit 612 executes the program using the second library to perform processing that uses only data of the data type defined in the second library. The first library application processing unit 613 executes the program using the first library to perform processing that uses data of the data type for processing using the first library.
[0109] The program execution unit 611 corresponds to an example of a program execution means, the second library application processing unit 612 corresponds to an example of a second library application processing means, and the first library application processing unit 613 corresponds to an example of a first library application processing means.
[0110] According to the information processing device 610, a data type that is defined in the first library but not in the second library is defined as a proxy type in the third library, so that processing using data of a data type that is not defined in the second library can also be performed using the third library.
[0111] In this way, when the information processing device 610 uses different libraries depending on the part of the program, each part of the program can be executed without having to explicitly switch the library to be used, even if the defined data types differ depending on the library.
[0112] This allows the information processing device 610 to execute a program using either the first library or the second library depending on the part of the program, without having to make any changes to the program that is written to use the first library.
[0113] Furthermore, in the information processing device 610, libraries can be hierarchically organized, such that the first library and the second library are called from the third library, and the configuration of the information processing device 610 can be simplified compared to when libraries to be used in program execution are explicitly switched. Furthermore, according to the information processing device 610, the hierarchical organization of libraries simplifies the processing flow, and it is expected that debugging can be performed relatively easily.
[0114] Third Embodiment Fig. 8 is a diagram showing an example of a processing procedure in an information processing method according to at least one embodiment. The information processing method shown in Fig. 8 includes executing a program (step S611). Executing the program (step S611) includes applying a second library (step S612) and applying a first library (step S613).
[0115] In executing the program (step S611), the computer executes the program using a third library in which a data type defined in the first library but not in the second library is defined as a data type for processing using the first library. In applying the second library (step S612), the computer executes a process using only data of the data type defined in the second library using the second library. In applying the first library (step S613), the computer executes a process using data of the data type for processing using the first library using the first library.
[0116] According to the information processing method shown in Figure 8, a data type that is defined in the first library but not in the second library is defined as a proxy type in the third library, so that processing using data of a data type that is not defined in the second library can also be performed using the third library.
[0117] In this way, in the information processing method shown in FIG. 8, when different libraries are used depending on the part of the program, even if the defined data types differ depending on the library, each part of the program can be executed without having to explicitly switch the library to be used.
[0118] As a result, in the information processing method shown in Figure 8, the program can be executed using the first library or the second library depending on the part of the program, without the need to make any changes to the program that is written to use the first library.
[0119] Furthermore, in the information processing method shown in Fig. 8, libraries can be hierarchically organized, such that the first library and the second library are called from the third library, and the configuration of the device that executes the information processing method shown in Fig. 8 can be simplified compared to when the library to be used is explicitly switched during program execution. Furthermore, according to the information processing method shown in Fig. 8, the hierarchical organization of libraries simplifies the processing flow, and it is expected that debugging will be relatively easy.
[0120] 9 is a schematic block diagram illustrating the configuration of a computer according to at least one embodiment. In the configuration shown in FIG. 9, a computer 700 includes a CPU 710, a main memory device 720, an auxiliary memory device 730, an interface 740, a non-volatile recording medium 750, and an accelerator 760.
[0121] One or more of the information processing device 100 and the information processing device 610, or a part thereof, may be implemented in the computer 700. In this case, the operation of each of the above-described processing units is stored in the auxiliary storage device 730 in the form of a program. The CPU 710 and the accelerator 760 read the program from the auxiliary storage device 730, load the program into the main storage device 720, and execute the above-described processing in accordance with the program. The CPU 710 also allocates storage areas in the main storage device 720 corresponding to each of the above-described storage units in accordance with the program. Communication between each device and other devices is performed by the interface 740, which has a communication function, and performs communication under the control of the CPU 710.
[0122] When the information processing device 100 is implemented in a computer 700, the operations of the control unit 190 and each of its units are stored in the form of a program in the auxiliary storage device 730. The CPU 710 and the accelerator 760 read the program from the auxiliary storage device 730, load it into the main storage device 720, and execute the above-described processing in accordance with the program.
[0123] Furthermore, the CPU 710 allocates a storage area for the storage unit 180 in the main storage device 720 in accordance with the program. Communication with other devices by the communication unit 110 is performed by the interface 740 having a communication function and operating under the control of the CPU 710. Display of images by the display unit 120 is performed by the interface 740 having a display device and displaying various images under the control of the CPU 710. Reception of user operations by the operation input unit 130 is performed by the interface 740 having an input device and receiving user operations under the control of the CPU 710.
[0124] When the information processing device 610 is implemented in the computer 700, the operations of the program execution unit 611, the second library application processing unit 612, and the first library application processing unit 613 are stored in the form of a program in the auxiliary storage device 730. The CPU 710 and the accelerator 760 read the program from the auxiliary storage device 730, load it into the main storage device 720, and execute the above-described processing in accordance with the program.
[0125] Furthermore, the CPU 710 allocates a storage area in the main storage device 720 for the information processing device 610 to perform processing in accordance with the program. Communication between the information processing device 610 and other devices is performed by the interface 740, which has a communication function and operates under the control of the CPU 710. Interaction between the information processing device 610 and a user is performed by the interface 740, which has a display device and an input device, displaying various images under the control of the CPU 710 and accepting user operations.
[0126] One or more of the above-described programs may be recorded on the nonvolatile recording medium 750. In this case, the interface 740 may read the programs from the nonvolatile recording medium 750. The CPU 710 and the accelerator 760 may then directly execute the programs read by the interface 740, or may temporarily store the programs in the main storage device 720 or the auxiliary storage device 730 and then execute them.
[0127] Note that a program for executing all or part of the processing performed by information processing device 100 and information processing device 610 may be recorded on a computer-readable recording medium, and the program recorded on the recording medium may be loaded into a computer system and executed to perform the processing of each unit. Note that the term "computer system" here includes hardware such as an operating system (OS) and peripheral devices. Furthermore, the term "computer-readable recording medium" refers to portable media such as flexible disks, optical magnetic disks, read-only memories (ROMs), and compact disc read-only memories (CD-ROMs), as well as storage devices such as hard disks built into computer systems. The program may be designed to implement part of the aforementioned functions, or may be capable of implementing the aforementioned functions in combination with a program already recorded on the computer system.
[0128] Although an embodiment of the present invention has been described above in detail with reference to the drawings, the specific configuration is not limited to this embodiment, and includes designs within the scope of the gist of the present invention.
[0129] A part or all of the above-described embodiments can be described as, but not limited to, the following supplementary notes.
[0130] (Supplementary Note 1) An information processing device comprising: a program execution means for executing a program using a third library in which a data type that is defined in a first library but not in a second library is defined as a data type for performing processing using the first library; a second library application processing means for performing processing using only data of the data type defined in the second library in the execution of the program, using the second library; and a first library application processing means for performing processing using data of the data type for performing processing using the first library in the execution of the program, using the first library.
[0131] (Supplementary Note 2) The information processing device according to Supplementary Note 1, further comprising: an intermediate representation generation means for generating an intermediate representation of a process that uses only data of a data type defined in the second library; and the second library application processing means for executing the intermediate representation.
[0132] (Appendix 3) An information processing device according to Appendix 1 or Appendix 2, further comprising a data conversion means for converting data obtained by processing using the first library and having a data type whose data representation format differs between the first library and the second library, from the data representation format in the first library to the data representation format in the second library.
[0133] (Appendix 4) An information processing device described in any one of Appendices 1 to 3, wherein a data type for processing using the first library is defined in the third library as a generic proxy type common to multiple data types defined in the first library, the program execution means treats data obtained using the first library that has a data type defined in the first library but not defined in the second library as generic proxy type data, and the first library application processing means performs processing using the generic proxy type data using the first library, treating the generic proxy type data as data of a data type in the first library.
[0134] (Supplementary Note 5) An information processing method including: a computer executes a program using a third library in which a data type that is defined in a first library but not in a second library is defined as a data type for processing using the first library; in executing the program, processing that uses only data of the data type defined in the second library is performed using the second library; and in executing the program, processing that uses data of the data type for processing using the first library is performed using the first library.
[0135] (Supplementary Note 6) The information processing method described in Supplementary Note 5 further includes the computer generating an intermediate representation of a process that uses only data of a data type defined in the second library, and executing the intermediate representation by performing the process using the second library.
[0136] (Supplementary Note 7) The information processing method described in Supplementary Note 5 or Supplementary Note 6, further comprising the computer converting data obtained by processing using the first library and having a data type whose data representation format differs between the first library and the second library from the data representation format in the first library to the data representation format in the second library.
[0137] (Appendix 8) An information processing method described in any one of Appendices 5 to 7, wherein a data type for processing using the first library is defined in the third library as a generic proxy type common to multiple data types defined in the first library, and when executing a program using the third library, data obtained using the first library that has a data type defined in the first library but not defined in the second library is treated as generic proxy type data, and when performing the processing using the first library, the processing using the generic proxy type data is performed using the first library, treating the generic proxy type data as data of a data type in the first library.
[0138] (Supplementary Note 9) A recording medium having a program recorded thereon, which causes a computer to execute a program using a third library in which a data type defined in a first library but not a second library is defined as a data type for processing using the first library, causes the second library to be used to perform processing using only data of the data type defined in the second library in the execution of the program, and causes the first library to be used to perform processing using data of the data type for processing using the first library in the execution of the program.
[0139] (Supplementary Note 10) The recording medium described in Supplementary Note 9, further causing the computer to generate an intermediate representation of a process that uses only data of a data type defined in the second library, and executing the intermediate representation when performing the process using the second library.
[0140] (Appendix 11) The recording medium described in Appendix 9 or Appendix 10, further causing the computer to convert data obtained by processing using the first library and having a data type whose data representation format differs between the first library and the second library from the data representation format in the first library to the data representation format in the second library.
[0141] (Appendix 12) A recording medium described in any one of Appendices 9 to 11, wherein a data type for processing using the first library is defined in the third library as a generic proxy type common to multiple data types defined in the first library, and by executing a program using the third library, data obtained using the first library, which has a data type defined in the first library but not defined in the second library, is treated as generic proxy type data, and by performing the processing using the first library, the processing using the generic proxy type data is performed using the first library, treating the generic proxy type data as data of a data type in the first library.
[0142] The present invention may be applied to an information processing device, an information processing method, and a recording medium.
[0143] 100, 610 Information processing device 110 Communication unit 120 Display unit 130 Operation input unit 180 Storage unit 190 Control unit 210 Front-end unit 211 Program execution unit 212 Intermediate representation generation unit 213 Data conversion unit 214 Parent library application processing unit 220 Intermediate unit 221 Optimization unit 230 Back-end unit 231 Intermediate representation execution unit 611 Program execution unit 612 Second library application processing unit 613 First library application processing unit
Claims
1. An information processing device comprising: a program execution means for executing a program using a third library in which a data type defined in a first library but not in a second library is defined as a data type for processing using the first library; a second library application processing means for performing processing using only data of the data type defined in the second library, using the second library, in executing the program; and a first library application processing means for performing processing using data of the data type for processing using the first library, using the first library, in executing the program.
2. An information processing device as described in claim 1, further comprising an intermediate representation generation means for generating an intermediate representation of a process that uses only data of a data type defined in the second library, wherein the second library application processing means executes the intermediate representation.
3. An information processing device as described in claim 1 or claim 2, further comprising a data conversion means for converting data obtained by processing using the first library and having a data type whose data representation format differs between the first library and the second library, from the data representation format in the first library to the data representation format in the second library.
4. An information processing device as described in any one of claims 1 to 3, wherein a data type for processing using the first library is defined in the third library as a generic proxy type common to multiple data types defined in the first library, the program execution means treats data obtained using the first library that has a data type defined in the first library but not defined in the second library as the generic proxy type data, and the first library application processing means performs processing using the generic proxy type data using the first library, treating the generic proxy type data as data of a data type in the first library.
5. An information processing method comprising: a computer executing a program using a third library in which a data type defined in a first library but not in a second library is defined as a data type for processing using the first library; in executing the program, processing using only data of the data type defined in the second library is performed using the second library; and in executing the program, processing using data of the data type for processing using the first library is performed using the first library.
6. A recording medium having a program recorded thereon, which causes a computer to execute a program using a third library in which a data type defined in a first library but not in a second library is defined as a data type for processing using the first library, and, in executing the program, causes the second library to perform processing using only data of the data type defined in the second library, and, in executing the program, causes the first library to perform processing using data of the data type for processing using the first library.
Citation Information
Patent Citations
Program transformation method, program transformer and storage medium having stored program transformation program
JP1999232117A
Software program equipped with alternative function library
JP2007149089A