Debian Codegraph @

rocrtst/suites/stress/memory_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_MEMORY_CONCURRENT_TESTS_H_
46 #define ROCRTST_SUITES_STRESS_MEMORY_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 MemoryConcurrentTest : public TestBase {
55 public:
56 MemoryConcurrentTest(bool launch_Concurrent_Allocate_,
57 bool launch_Concurrent_Free_ ,
58 bool launch_Concurrent_PoolGetInfo_);
59
60 // @Brief: Destructor for test case of MemoryTest
61 virtual ~MemoryConcurrentTest();
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: This test verify check memory can be
80 // concurrently allocated from pool on ROCR agents
81 void MemoryConcurrentAllocate(void);
82
83 // @Brief: This test verify check memory can be
84 // concurrently freed from pool on ROCR agents
85 void MemoryConcurrentFree(void);
86
87 // @Brief: This test verify if each Agent pool's attribute information
88 // is consistent across multiple thread.
89 void MemoryConcurrentPoolGetInfo(void);
90
91 private:
92 void MemoryConcurrentAllocate(hsa_agent_t agent,
93 hsa_amd_memory_pool_t pool);
94 void MemoryConcurrentFree(hsa_agent_t agent,
95 hsa_amd_memory_pool_t pool);
96 void MemoryConcurrentPoolGetInfo(hsa_agent_t agent,
97 hsa_amd_memory_pool_t pool);
98
99 // @Brief: Indicate if launch concurrent allocate test
100 bool launch_Concurrent_Allocate_;
101
102 // @Brief: Indicate if launch concurrent Free test
103 bool launch_Concurrent_Free_;
104
105 // @Brief: Indicate if launch concurrent pool get info test
106 bool launch_Concurrent_PoolGetInfo_;
107 };
108
109 #endif // ROCRTST_SUITES_STRESS_MEMORY_CONCURRENT_TESTS_H_