HSA Runtime Programmer's Reference Manual Version

HSA Runtime Programmer's Reference Manual Version

HSA Runtime Programmer’s Reference Manual Revision: Version 1.2 • Issue Date: 2 May 2018 © 2018 HSA Foundation. All rights reserved. The contents of this document are provided in connection with the HSA Foundation specifications. This specification is protected by copyright laws and contains material proprietary to the HSA Foundation. It or any components may not be reproduced, republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of HSA Foundation. You may use this specification for implementing the functionality therein, without altering or removing any trademark, copyright or other notice from the specification, but the receipt or possession of this specification does not convey any rights to reproduce, disclose, or distribute its contents, or to manufacture, use, or sell anything that it may describe, in whole or in part. HSA Foundation grants express permission to any current Founder, Promoter, Supporter Contributor, Academic or Associate member of HSA Foundation to copy and redistribute UNMODIFIED versions of this specification in any fashion, provided that NO CHARGE is made for the specification and the latest available update of the specification for any version of the API is used whenever possible. Such distributed specification may be re-formatted AS LONG AS the contents of the specification are not changed in any way. The specification may be incorporated into a product that is sold as long as such product includes significant independent work developed by the seller. A link to the current version of this specification on the HSA Foundation web-site should be included whenever possible with specification distributions. HSA Foundation makes no, and expressly disclaims any, representations or warranties, express or implied, regarding this specification, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose or non-infringement of any intellectual property. HSA Foundation makes no, and expressly disclaims any, warranties, express or implied, regarding the correctness, accuracy, completeness, timeliness, and reliability of the specification. Under no circumstances will the HSA Foundation, or any of its Founders, Promoters, Supporters, Academic, Contributors, and Associates members or their respective partners, officers, directors, employees, agents or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with these materials. 2 | HSA Runtime Programmer’s Reference Manual, Version 1.2 Acknowledgments Acknowledgments This specification is the result of the contributions of many people. Here is a partial list of the contributors, including the companies and educational institutions that they represented at the time of their contribution. AMD ARM l Prasad Apte l Djordje Kovacevic l Jason Parker l Paul Blinzer l Håkan Persson l Fan Cao l Jay Cornwall Codeplay l Wei Ding l Simon Brand (spec editor) l Adrian Edwards l Ralph Potter l Ramesh Errabolu l Andrew Richards (workgroup chair) l Al Grant General Processor l Mark Herdeg l Chris Hesik l Paul D'Arcy l Sean Keely l John Glossner l Mario Méndez-Lojo Imagination l Callan McInally l James Aldis l Perhaad Mistry l Andy Glew l Budirijanto Purnomo l John Howson l Shreyas Ramalingam l James McCarthy l Jason Meredith l Ben Sander l Mark Rankilor l Yaki Tebeka l Zoran Zaric l Hari Thangirala Mediatek l Vinod Tipparaju l Rahul Agarwal l Tony Tye l Richard Bagley l Besar Wicaksono l Barz Hsu l Shucai Xiao l Emerson Huang l Roy Ju l Ming Yao l Jason Lin l Konstantin Zhuravlyov l Trent Lo MultiCore Ware l Tom Jablin HSA Runtime Programmer’s Reference Manual, Version 1.2 | 3 Acknowledgments National Taiwan University l Medicine Yeh Northeastern University l Dave Kaeli Qualcomm l Greg Bellows l Lihan Bin l Alex Bourd l Benedict Gaster l Lee Howes l Bob Rychlik l Robert J. Simpson Rice University l Laksono Ahdianto Samsung Electronics l Soojung Ryu l Michael C. Shebanow Sandia National Laboratories l Simon D. Hammond l Dylan Stark SUSE LLC l Martin Jambor Via Alliance Technologies l Mike Hong 4 | HSA Runtime Programmer’s Reference Manual, Version 1.2 Contents Contents Acknowledgments 3 Chapter 1. Introduction 14 1.1 Overview 14 1.2 Programming model 16 1.2.1 Initialization and agent discovery 16 1.2.2 Queues and AQL packets 17 1.2.3 Signals and packet launch 18 Chapter 2. HSA Core Programming Guide 19 2.1 Initialization and shut down 19 2.1.1 Initialization and shut down API 20 2.1.1.1 hsa_init 20 2.1.1.2 hsa_shut_down 20 2.2 Runtime notifications 21 2.2.1 Runtime notifications API 22 2.2.1.1 hsa_status_t 22 2.2.1.2 hsa_status_string 24 2.3 System and agent information 25 2.3.1 System and agent information API 25 2.3.1.1 hsa_endianness_t 25 2.3.1.2 hsa_machine_model_t 26 2.3.1.3 hsa_profile_t 26 2.3.1.4 hsa_system_info_t 26 2.3.1.5 hsa_system_get_info 27 2.3.1.6 hsa_extension_t 28 2.3.1.7 hsa_extension_get_name 28 2.3.1.8 hsa_system_extension_supported (Deprecated) 29 2.3.1.9 hsa_system_major_extension_supported 29 2.3.1.10 hsa_system_get_extension_table (Deprecated) 30 2.3.1.11 hsa_system_get_major_extension_table 31 2.3.1.12 hsa_agent_t 32 2.3.1.13 hsa_agent_feature_t 32 2.3.1.14 hsa_device_type_t 32 2.3.1.15 hsa_default_float_rounding_mode_t 33 2.3.1.16 hsa_agent_info_t 33 2.3.1.17 hsa_agent_group_segment_type_t 37 2.3.1.18 hsa_agent_get_info 37 2.3.1.19 hsa_iterate_agents 38 2.3.1.20 hsa_exception_policy_t 39 2.3.1.21 hsa_agent_get_exception_policies (Deprecated) 39 2.3.1.22 hsa_cache_t 40 2.3.1.23 hsa_cache_info_t 40 2.3.1.24 hsa_cache_get_info 41 2.3.1.25 hsa_agent_iterate_caches 41 2.3.1.26 hsa_agent_extension_supported (Deprecated) 42 2.3.1.27 hsa_agent_major_extension_supported 43 2.4 Signals 44 2.4.1 Signals API 45 2.4.1.1 hsa_signal_value_t 45 HSA Runtime Programmer’s Reference Manual, Version 1.2 | 5 Contents 2.4.1.2 hsa_signal_t 45 2.4.1.3 hsa_signal_create 45 2.4.1.4 hsa_signal_destroy 46 2.4.1.5 hsa_signal_load 46 2.4.1.6 hsa_signal_load_acquire (Deprecated) 47 2.4.1.7 hsa_signal_store 47 2.4.1.8 hsa_signal_store_release (Deprecated) 47 2.4.1.9 hsa_signal_silent_store 48 2.4.1.10 hsa_signal_exchange 48 2.4.1.11 hsa_signal_exchange_acq_rel (Deprecated) 49 2.4.1.12 hsa_signal_exchange_acquire (Deprecated) 50 2.4.1.13 hsa_signal_exchange_release (Deprecated) 50 2.4.1.14 hsa_signal_cas 51 2.4.1.15 hsa_signal_cas_acq_rel (Deprecated) 51 2.4.1.16 hsa_signal_cas_acquire (Deprecated) 52 2.4.1.17 hsa_signal_cas_release (Deprecated) 52 2.4.1.18 hsa_signal_add 53 2.4.1.19 hsa_signal_add_acq_rel (Deprecated) 54 2.4.1.20 hsa_signal_add_acquire (Deprecated) 54 2.4.1.21 hsa_signal_add_release (Deprecated) 54 2.4.1.22 hsa_signal_subtract 55 2.4.1.23 hsa_signal_subtract_acq_rel (Deprecated) 55 2.4.1.24 hsa_signal_subtract_acquire (Deprecated) 56 2.4.1.25 hsa_signal_subtract_release (Deprecated) 56 2.4.1.26 hsa_signal_and 57 2.4.1.27 hsa_signal_and_acq_rel (Deprecated) 57 2.4.1.28 hsa_signal_and_acquire (Deprecated) 58 2.4.1.29 hsa_signal_and_release (Deprecated) 58 2.4.1.30 hsa_signal_or 59 2.4.1.31 hsa_signal_or_acq_rel (Deprecated) 59 2.4.1.32 hsa_signal_or_acquire (Deprecated) 60 2.4.1.33 hsa_signal_or_release (Deprecated) 60 2.4.1.34 hsa_signal_xor 60 2.4.1.35 hsa_signal_xor_acq_rel (Deprecated) 61 2.4.1.36 hsa_signal_xor_acquire (Deprecated) 61 2.4.1.37 hsa_signal_xor_release (Deprecated) 62 2.4.1.38 hsa_signal_condition_t 62 2.4.1.39 hsa_wait_state_t 63 2.4.1.40 hsa_signal_wait 63 2.4.1.41 hsa_signal_wait_acquire (Deprecated) 64 2.4.1.42 hsa_signal_group_t 65 2.4.1.43 hsa_signal_group_create 65 2.4.1.44 hsa_signal_group_destroy 66 2.4.1.45 hsa_signal_group_wait_any 67 2.5 Queues 68 2.5.1 Single vs. multiple producers 69 2.5.2 Example: a simple dispatch 70 2.5.3 Example: error callback 70 2.5.4 Example: concurrent packet submissions 71 2.5.5 Queues API 72 2.5.5.1 hsa_queue_type_t 72 2.5.5.2 hsa_queue_type32_t 72 2.5.5.3 hsa_queue_feature_t 73 2.5.5.4 hsa_queue_t 73 2.5.5.5 hsa_queue_create 74 6 | HSA Runtime Programmer’s Reference Manual, Version 1.2 Contents 2.5.5.6 hsa_soft_queue_create 76 2.5.5.7 hsa_queue_destroy 77 2.5.5.8 hsa_queue_inactivate 78 2.5.5.9 hsa_queue_load_read_index 79 2.5.5.10 hsa_queue_load_read_index_acquire (Deprecated) 79 2.5.5.11 hsa_queue_load_write_index 80 2.5.5.12 hsa_queue_load_write_index_acquire (Deprecated) 80 2.5.5.13 hsa_queue_store_write_index 80 2.5.5.14 hsa_queue_store_write_index_release (Deprecated) 81 2.5.5.15 hsa_queue_cas_write_index 81 2.5.5.16 hsa_queue_cas_write_index_acq_rel (Deprecated) 82 2.5.5.17 hsa_queue_cas_write_index_acquire(Deprecated) 82 2.5.5.18 hsa_queue_cas_write_index_release (Deprecated) 83 2.5.5.19 hsa_queue_add_write_index 83 2.5.5.20 hsa_queue_add_write_index_acq_rel (Deprecated) 84 2.5.5.21 hsa_queue_add_write_index_acquire (Deprecated) 84 2.5.5.22 hsa_queue_add_write_index_release (Deprecated) 85 2.5.5.23 hsa_queue_store_read_index 85 2.5.5.24 hsa_queue_store_read_index_release (Deprecated) 86 2.6 Architected Queuing Language packets 86 2.6.1 Kernel dispatch packet 86 2.6.1.1 Example: populating the kernel dispatch packet 87 2.6.2 Agent dispatch packet 88 2.6.2.1 Example: application processes allocation service requests from kernel agent 88 2.6.3 Barrier-AND and barrier-OR packets 90 2.6.3.1 Example: handling dependencies across kernels running in different kernel agents 90 2.6.4 Packet states 91 2.6.5 Architected Queuing Language packets API 93 2.6.5.1

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    276 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us