Skip to content

Commit 590ce6e

Browse files
Merge branch 'main' into mem_obj_proposal
2 parents 3186b53 + 5e70ccc commit 590ce6e

File tree

6 files changed

+86
-48
lines changed

6 files changed

+86
-48
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
[![GHA build status](https://github.com/oneapi-src/unified-runtime/actions/workflows/cmake.yml/badge.svg?branch=main)](https://github.com/oneapi-src/unified-runtime/actions)
44

5+
> **Note**
6+
>
7+
> For those who intend to make a contribution to the project please read our
8+
> [Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html)
9+
> for more information.
10+
511
## Contents
612

713
This repo contains the following:

scripts/core/CONTRIB.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ following command (or suitable build system equivalent):
6060
.. _YAML syntax:
6161
https://github.com/oneapi-src/unified-runtime/blob/main/scripts/YaML.md
6262

63+
.. note::
64+
65+
The generated source and header files are placed into ``/source`` and
66+
``/include`` directories respectively. You *should* make no attempt to
67+
modify them directly. When the generator is run all your changes will be
68+
overwritten.
69+
6370
Writing YAML
6471
============
6572

@@ -170,6 +177,15 @@ Conformance tests *must* not make assumptions about the adapter under test.
170177
Tests fixtures or cases *must* query for support of optional features and skip
171178
testing if unsupported by the adapter.
172179

180+
All tests in the Unified Runtime project are configured to use CTest to run.
181+
All conformance tests have the ``conformance`` label attached to them which
182+
allows them to be run independently. To run all the conformance tests, execute
183+
the following command from the build directory.
184+
185+
.. code-block:: console
186+
187+
ctest -L "conformance"
188+
173189
Experimental Features
174190
=====================
175191

scripts/generate_docs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def _make_ref(symbol, symbol_type, meta):
7575
ref = ":ref:`" + ref + " <" + target.replace("_", "-") + ">`"
7676
else:
7777
print("%s(%s) : error : enum symbol not found for etor %s"%(fin, iline+1, symbol))
78+
raise Exception()
7879
elif not re.match("function", symbol_type):
7980
ref = ":ref:`" + ref.replace("_", "-") + "`"
8081
else:
@@ -92,6 +93,8 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
9293

9394
print("Generating %s..."%fout)
9495

96+
error = False
97+
9598
outlines = []
9699
for iline, line in enumerate(util.textRead(fin)):
97100

@@ -116,6 +119,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
116119

117120
if re.match(RE_INVALID_TAG_FORMAT, line):
118121
print("%s(%s) : error : invalid %s tag used"%(fin, iline+1, re.sub(RE_INVALID_TAG_FORMAT, r"\1", line)))
122+
error = True
119123

120124
newline = line # new line will contain proper tags for reStructuredText if needed.
121125
if re.match(RE_PROPER_TAG_FORMAT, line):
@@ -128,6 +132,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
128132
symbol_type = _find_symbol_type(symbol, meta)
129133
if not symbol_type:
130134
print("%s(%s) : error : symbol '%s' not found"%(fin, iline+1, symbol))
135+
error = True
131136
continue
132137

133138
if code_block and 'function' == symbol_type:
@@ -136,6 +141,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
136141
if len(words) != len(meta['function'][symbol]['params']):
137142
print("%s(%s) : error : %s parameter count mismatch - %s actual vs. %s expected"%(fin, iline+1, symbol, len(words), len(meta['function'][symbol]['params'])))
138143
print("line = %s"%line)
144+
error = True
139145

140146
ref = _make_ref(symbol, symbol_type, meta)
141147
if ref:
@@ -157,6 +163,9 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
157163

158164
outlines.append(newline)
159165

166+
if error:
167+
raise Exception('Error during reStructuredText generation.')
168+
160169
util.writelines(os.path.abspath(fout), outlines)
161170

162171
return util.makoWrite(os.path.abspath(fout), fout,

scripts/parse_specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def __validate_params(d, tags):
430430
print("%s(%s): %s!"%(os.path.abspath(f), line_num, msg))
431431
print("-- Function Info --")
432432
print(d)
433-
return False
433+
raise
434434

435435
"""
436436
filters object by version

scripts/run.py

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -133,69 +133,76 @@ def main():
133133
'meta' : {},
134134
'ref' : {}
135135
}
136+
137+
try:
136138

137-
for section in configParser.sections():
138-
input['configs'].append({
139-
'name' : section,
140-
'namespace': configParser.get(section,'namespace'),
141-
'tags' : {'$'+key : configParser.get(section,key) for key in configParser.get(section,'tags').split(",")},
142-
})
139+
for section in configParser.sections():
140+
input['configs'].append({
141+
'name' : section,
142+
'namespace': configParser.get(section,'namespace'),
143+
'tags' : {'$'+key : configParser.get(section,key) for key in configParser.get(section,'tags').split(",")},
144+
})
145+
146+
# phase 2: parse specs
147+
for config in input['configs']:
148+
specs, input['meta'], input['ref'] = parse_specs.parse(config['name'], args['ver'], config['tags'], input['meta'], input['ref'])
149+
input['specs'].append(specs)
150+
151+
util.jsonWrite(args['api_json'], input)
143152

144-
# phase 2: parse specs
145-
for config in input['configs']:
146-
specs, input['meta'], input['ref'] = parse_specs.parse(config['name'], args['ver'], config['tags'], input['meta'], input['ref'])
147-
input['specs'].append(specs)
153+
# phase 3: generate files
154+
if args['clean']:
155+
clean()
148156

149-
util.jsonWrite(args['api_json'], input)
157+
incpath = os.path.join("../include/")
158+
srcpath = os.path.join("../source/")
159+
docpath = os.path.join("../docs/")
150160

151-
# phase 3: generate files
152-
if args['clean']:
153-
clean()
161+
generate_docs.prepare(docpath, args['rst'], args['html'], args['ver'])
162+
generate_docs.generate_ref(docpath, input['ref'])
154163

155-
incpath = os.path.join("../include/")
156-
srcpath = os.path.join("../source/")
157-
docpath = os.path.join("../docs/")
164+
for idx, specs in enumerate(input['specs']):
165+
config = input['configs'][idx]
166+
if args[config['name']]:
158167

159-
generate_docs.prepare(docpath, args['rst'], args['html'], args['ver'])
160-
generate_docs.generate_ref(docpath, input['ref'])
168+
generate_code.generate_api(incpath, srcpath, config['namespace'], config['tags'], args['ver'], args['rev'], specs, input['meta'])
161169

162-
for idx, specs in enumerate(input['specs']):
163-
config = input['configs'][idx]
164-
if args[config['name']]:
170+
if args['rst']:
171+
generate_docs.generate_rst(docpath, config['name'], config['namespace'], config['tags'], args['ver'], args['rev'], specs, input['meta'])
165172

166-
generate_code.generate_api(incpath, srcpath, config['namespace'], config['tags'], args['ver'], args['rev'], specs, input['meta'])
173+
if util.makeErrorCount():
174+
print("\n%s Errors found during generation, stopping execution!"%util.makeErrorCount())
175+
return
167176

168-
if args['rst']:
169-
generate_docs.generate_rst(docpath, config['name'], config['namespace'], config['tags'], args['ver'], args['rev'], specs, input['meta'])
177+
if args['debug']:
178+
util.makoFileListWrite("generated.json")
170179

171-
if util.makeErrorCount():
172-
print("\n%s Errors found during generation, stopping execution!"%util.makeErrorCount())
173-
return
180+
# phase 4: build code
181+
if args['build']:
182+
if not build():
183+
print("\nBuild failed, stopping execution!")
184+
return
174185

175-
if args['debug']:
176-
util.makoFileListWrite("generated.json")
186+
# phase 5: prep for publication of html or pdf
187+
if args['html'] or args['pdf']:
188+
generate_docs.generate_common(docpath, configParser.sections(), args['ver'], args['rev'])
177189

178-
# phase 4: build code
179-
if args['build']:
180-
if not build():
181-
print("\nBuild failed, stopping execution!")
182-
return
190+
# phase 5: publish documentation
191+
if args['html']:
192+
generate_docs.generate_html(docpath)
183193

184-
# phase 5: prep for publication of html or pdf
185-
if args['html'] or args['pdf']:
186-
generate_docs.generate_common(docpath, configParser.sections(), args['ver'], args['rev'])
194+
if args['pdf']:
195+
generate_docs.generate_pdf(docpath)
187196

188-
# phase 5: publish documentation
189-
if args['html']:
190-
generate_docs.generate_html(docpath)
197+
if args['update_spec']:
198+
update_spec(args['update_spec'])
191199

192-
if args['pdf']:
193-
generate_docs.generate_pdf(docpath)
200+
print("\nCompleted in %.1f seconds!"%(time.time() - start))
194201

195-
if args['update_spec']:
196-
update_spec(args['update_spec'])
202+
except:
203+
print("Failed to generate specification.")
204+
return sys.exit(1)
197205

198-
print("\nCompleted in %.1f seconds!"%(time.time() - start))
199206

200207
if __name__ == '__main__':
201208
main()

scripts/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def makoWrite(inpath, outpath, **args):
168168
line = "%s: %s" % (str(traceback.error.__class__.__name__), traceback.error)
169169
makoErrorList.append(line)
170170
print(line)
171-
return 0
171+
raise
172172

173173
def makoFileListWrite(outpath):
174174
jsonWrite(outpath, makoFileList)

0 commit comments

Comments
 (0)