background image

 

 

 

Rev. 1.01 

24 

 

 

 

 

AmdDxLfRegionDesc regionDesc;  

regionDesc.fileOffset = FILE_OFFSET; 

regionDesc.bufferOffset = BUFF_OFFSET; 

regionDesc.regionSize = dxLFFileInfo.blockSize; 

 

// Read information from the file: BUFF_OFFSET, SIZE_TO_READ and FILE_OFFSET must  

// align with the sector size. 

hr = dxSsgExt->ReadBufferFromFile(pDxBuffer, hSsgFile, 1, &regionDescs, nullptr);

  

if (FAILED(hr)) { 

     

 

s

td::cout

 << 

"Error: Unable to read data from file."

 << std::endl; 

 

// Release the file when you’re done with it. 

hr = dxSsgExt->ReleaseFile(hSsgFile);  

if (FAILED(hr)) { 

     

 

s

td::cout

 << 

"Warning: Unable to release file."

 << std::endl; 

 

 

Содержание Pro Solid State Graphics

Страница 1: ...Solid State Graphics SSG API User Manual ...

Страница 2: ...D Code Sample for OpenCL 10 6 OpenGL Extension Specification 11 6 1 glCreateFileAMD 11 6 2 glReleaseFileAMD 11 6 3 glGetFileParameteri64vAMD 11 6 4 glReadFileAMD 12 6 5 glWriteFileAMD 13 7 OpenGL Performance Guidelines and Caveats 14 8 AMD Code Sample for OpenGL 16 9 DirectX 11 Extension Specification 17 9 1 GetExtensionVersion 18 9 2 CreateFile 18 9 3 ReleaseFile 18 9 4 GetFileInfo 19 9 5 CreateE...

Страница 3: ...CL file object Doing so over a file employs the same semantics as when opening the file for reading writing that is read write privileges are required for that file Context in A CL context with which to associate the file Flags in Access privilege flag for the file Currently only CL_FILE_READ_ONLY_AMD and CL_FILE_WRITE_ONLY_AMD are supported Read or write privileges are required for the file subje...

Страница 4: ...greater than or equal to the size of the return type described in the table above param_value out optional Pointer to the memory region that stores the appropriate result being queried If param_value is NULL the function ignores this pointer param_value_size_ret out Returns the actual size in bytes Return Value Description CL_SUCCESS The function executed successfully CL_INVALID_FILE_OBJECT_AMD Th...

Страница 5: ...buffer is the target memory object Create the buffer using either CL_MEM_ALLOC_HOST_PTR CL_MEM_USE_HOST_PTR or CL_MEM_USE_PERSISTENT_MEM_AMD blocking_read in Indicates whether the read operation is blocking or non blocking If blocking_read is CL_TRUE the function call won t return until the operation has completed If blocking_read is CL_FALSE the OpenCL implementation will perform a non blocking r...

Страница 6: ...he function returns event out optional Returns an event object that identifies the clEnqueueReadSsgFileAMD command and can query the command status or queue a wait for the command to finish executing The event argument can be NULL in which case the application will be unable to query the command status or queue a wait for the command to finish Unless event_wait_list and event are both NULL event s...

Страница 7: ...uffer object being read It must be a multiple of CL_FILE_BLOCK_SIZE_AMD size in Size in bytes of the data being written It must be a multiple of CL_FILE_BLOCK_SIZE_AMD If the file size is not a multiple of the block size write to the end of the file by aligning the write size with the next block multiple beyond the file size file in File object to which the copy is initiated file_offset in Offset ...

Страница 8: ...bounds or misaligned with CL_FILE_BLOCK_SIZE_AMD CL_INVALID_EVENT_WAIT_LIST Either event_wait_list is NULL and num_events_in_wait_list is greater than 0 event_wait_list is not NULL and num_events_in_wait_list is 0 or event objects in event_wait_list are invalid CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST Write operations are blocking and the execution status of at least one event in event_wait_li...

Страница 9: ...device copies will execute at full memory controller speed which varies from 100 GB s to 500 GB s depending on the GPU type The copy size buffer offset and file offset must adhere to the SSD s alignment restrictions Discover these restrictions by calling clGetSsgFileObjectInfoAMD ...

Страница 10: ...ctorSize sectorSize retSize if clStatus CL_SUCCESS std cout Error Unable to retrieve file size std endl return if retSize sizeof sectorSize std cout Error Invalid sector size info returned std endl return Create buffer cl_mem clBuffer clCreateBuffer m_clContext CL_MEM_ USE_PERSISTENT_MEM_AMD DATA_SIZE_IN_BYTES nullptr clStatus if clStatus CL_SUCCESS std cout Error Unable to create buffer std endl ...

Страница 11: ...he file must have read write privileges name in Name of the file to open or create The file name supports only UTF 8 wide character Unicode strings are currently unsupported mode in Mode in which the file is to be created GL_READ_ONLY GL_WRITE_ONLY or GL_READ_WRITE Return Value Description NULL The function is unable to create open the file 6 2 glReleaseFileAMD The glReleaseFileAMD function detach...

Страница 12: ...mance dstBuffer in A valid named buffer object that will hold the read result The best performance is obtained by creating the buffer with the MAP_PERSISTENT_BIT flag but without CLIENT_STORAGE_BIT file in The GL file from which information is being read bufferOffset in Location in the buffer from which data of width size in bytes will be read It must be a multiple of GL_FILE_BLOCK_SIZE_AMD fileOf...

Страница 13: ...of bufferOffset and size exceeds the size of the target buffer INVALID_VALUE The fileOffset size and bufferOffset values are not multiples of GL_FILE_BLOCK_SIZE_AMD INVALID_OPERATION Failure to access the file with the specified fileOffset and size values INVALID_OPERATION The sync argument isn t NULL and the buffer object wasn t created with the MAP_PERSISTENT_BIT flag but without CLIENT_STORAGE_...

Страница 14: ...ffer object wasn t created with the MAP_PERSISTENT_BIT flag but without CLIENT_STORAGE_BIT 7 OpenGL Performance Guidelines and Caveats The following guidelines and caveats will help realize the greatest performance from OpenGL The copy size buffer offset and file offset must adhere to the SSD s alignment restrictions Discover these restrictions by calling glGetFileParameteri64vAMD Performing multi...

Страница 15: ...T_BIT OpenGL also provides other ways to allocate local invisible memory glBufferData and glBufferSubData Only when the buffer is created in local visible video memory using glNamedBufferStorage with the GL_MAP_READ_BIT GL_MAP_WRITE_BIT GL_MAP_PERSISTENT_BIT flag set will read write operations work in asynchronous mode Otherwise the driver will ignore the sync object ...

Страница 16: ... Create buffer GLuint oglBuffer glCreateBuffers 1 oglBuffer glNamedBufferStorage oglBuffer SIZE_TO_READ nullptr GL_MAP_READ_BIT GL_MAP_WRITE_BIT GL_MAP_PERSISTENT_BIT if glGetError GL_NO_ERROR std cout Error Failed to allocate openGL buffer std endl return Read information from the file BUFF_OFFSET SIZE_TO_READ and FILE_OFFSET must align with the sector size glReadFileAMD oglBuffer hSsgFileFile BU...

Страница 17: ...RESULT ReleaseFile AmdDxSsgFileHandle hFile 0 Get the file size information The file transfer in the SSG extension requires that the transfer size and offset align with the block boundary virtual HRESULT GetFileInfo AmdDxSsgFileHandle hFile AmdDxSsgFileInfo pInfo 0 Create an event to use in asynchronous file transfer virtual HRESULT CreateEvent AmdDxSsgEventHandle phEvent 0 Delete an event virtual...

Страница 18: ...value is NULL 9 2 CreateFile The CreateFile function creates a DirectX file object Using it over a file employs the same semantics as when the file is opened for reading writing that is the file must have read write privileges pFileName in Name of the file to be opened or created fileAccess in Request read write access for the file phFile out SSG file handle for use in subsequent data transfer cal...

Страница 19: ...ludes the file size and sector size Use the sector size when calculating the buffer size alignment and the regions desired to be read hFile in Handle for SSG file from which information is to be retrieved pInfo out Structure to be filled with the file and sector size information Return Value Description S_OK The function succeeded 9 5 CreateEvent The CreateEvent function creates a synchronization ...

Страница 20: ...transfers to finish Return Value Description S_OK The function succeeded E_INVALIDARG Unable to delete event handle 9 7 WaitEvent The WaitEvent function waits for asynchronous file transfers to complete The synchronization event should have already been used in a previous transfer call hEvent in Handle of SSG event to wait on Remarks The wait time on an event yet to be used in an asynchronous call...

Страница 21: ... the data transfer Each region contains the file offset to read from the buffer offset to write to and the size of the data to write in bytes They must be a multiple of sector size hEvent in SSG event handle to wait on If the call omits an event the function will be synchronous and will return after the data transfer is complete If the call includes an event the function will return immediately an...

Страница 22: ...e data transfer Each region contains the file offset to write to the buffer offset to read from and the size of the data to write in bytes They must be a multiple of sector size hEvent in SSG event handle to wait on If the call omits an event the function will be synchronous and will return after the data transfer is complete If the call includes an event the function will return immediately and t...

Страница 23: ...ut Error Unable to get DX SSG extension std endl return Create SSG file handle AmdDxSsgFileHandle hSsgFile HRESULT hr dxSsgExt CreateFile FILE_NAME AmdDxSsgFile_Read hSsgFile If FAILED hr std cout Error Unable to create liquid flash file handle std endl return Get the file information file size and block size AmdDxSsgFileInfo dxSsgFileInfo hr dxSsgExt GetFileInfo hSsgFile dxSsgFileInfo if FAILED h...

Страница 24: ...ation from the file BUFF_OFFSET SIZE_TO_READ and FILE_OFFSET must align with the sector size hr dxSsgExt ReadBufferFromFile pDxBuffer hSsgFile 1 regionDescs nullptr if FAILED hr std cout Error Unable to read data from file std endl Release the file when you re done with it hr dxSsgExt ReleaseFile hSsgFile if FAILED hr std cout Warning Unable to release file std endl ...

Страница 25: ...re or other products described herein No license including implied or arising by estoppel to any intellectual property rights is granted by this document Terms and limitations applicable to the purchase or use of AMD s products are as set forth in a signed agreement between the parties or in AMD s Standard Terms and Conditions of Sale Legal Attributions 2017 Advanced Micro Devices Inc All rights r...

Отзывы: