Debian Codegraph @

rocrtst/suites/stress/queue_write_index_concurrent_tests.h

raw
1 /*
2 * =============================================================================
3 * ROC Runtime Conformance Release License
4 * =============================================================================
5 * The University of Illinois/NCSA
6 * Open Source License (NCSA)
7 *
8 * Copyright (c) 2018, Advanced Micro Devices, Inc.
9 * All rights reserved.
10 *
11 * Developed by:
12 *
13 * AMD Research and AMD ROC Software Development
14 *
15 * Advanced Micro Devices, Inc.
16 *
17 * www.amd.com
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining a copy
20 * of this software and associated documentation files (the "Software"), to
21 * deal with the Software without restriction, including without limitation
22 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
23 * and/or sell copies of the Software, and to permit persons to whom the
24 * Software is furnished to do so, subject to the following conditions:
25 *
26 * - Redistributions of source code must retain the above copyright notice,
27 * this list of conditions and the following disclaimers.
28 * - Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimers in
30 * the documentation and/or other materials provided with the distribution.
31 * - Neither the names of <Name of Development Group, Name of Institution>,
32 * nor the names of its contributors may be used to endorse or promote
33 * products derived from this Software without specific prior written
34 * permission.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
39 * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
40 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
41 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42 * DEALINGS WITH THE SOFTWARE.
43 *
44 */
45 #ifndef ROCRTST_SUITES_STRESS_QUEUE_WRITE_INDEX_CONCURRENT_TESTS_H_
46 #define ROCRTST_SUITES_STRESS_QUEUE_WRITE_INDEX_CONCURRENT_TESTS_H_
47
48
49 #include "common/base_rocr.h"
50 #include "hsa/hsa.h"
51 #include "suites/test_common/test_base.h"
52
53
54 class QueueWriteIndexConcurrentTest : public TestBase {
55 public:
56 QueueWriteIndexConcurrentTest(bool launch_Concurrent_AddWriteIndex,
57 bool launch_Concurrent_CasWriteIndex ,
58 bool launch_Concurrent_LoadStoreWriteIndex);
59
60 // @Brief: Destructor for test case of MemoryTest
61 virtual ~QueueWriteIndexConcurrentTest();
62
63 // @Brief: Setup the environment for measurement
64 virtual void SetUp();
65
66 // @Brief: Core measurement execution
67 virtual void Run();
68
69 // @Brief: Clean up and retrive the resource
70 virtual void Close();
71
72 // @Brief: Display results
73 virtual void DisplayResults() const;
74
75 // @Brief: Display information about what this test does
76 virtual void DisplayTestInfo(void);
77
78
79 // @Brief: Verifies that the hsa_queue_write_index_add operations is atomic,
80 // and 'torn' adds do not occur when this API is executed concurrently.
81 void QueueAddWriteIndexAtomic(void);
82
83 // @Brief: Verifies that the hsa_queue_cas_write_index operations is atomic,
84 // and 'torn' compare and swaps do not occur when this API is executed
85 // concurrently.
86 void QueueCasWriteIndexAtomic(void);
87
88 // @Brief: Verifies that the hsa_queue_write_index_load and store operations
89 // are atomic, and 'torn' loads or stores do not occur when these APIs are executed
90 // concurrently.
91 void QueueLoadStoreWriteIndexAtomic(void);
92
93 private:
94 void QueueAddWriteIndexAtomic(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent);
95 void QueueCasWriteIndexAtomic(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent);
96 void QueueLoadStoreWriteIndexAtomic(hsa_agent_t cpuAgent, hsa_agent_t gpuAgent);
97 };
98
99 #endif // ROCRTST_SUITES_STRESS_QUEUE_WRITE_INDEX_CONCURRENT_TESTS_H_