Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 131a5a8

Browse files
authored
Merge pull request #95 from seq-lang/develop
Develop
2 parents a86be08 + 870fdbf commit 131a5a8

File tree

21 files changed

+274
-84
lines changed

21 files changed

+274
-84
lines changed

CONTRIBUTING.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Contributing to Seq
2+
3+
Thank you for considering contributing to Seq! This document contains some helpful information for getting started. The best place to ask questions or get feedback is [our Gitter chatroom](https://gitter.im/seq-lang/Seq). For a high-level outline of the features we aim to add in the future, check the [roadmap](https://github.com/seq-lang/seq/wiki/Roadmap).
4+
5+
## An overview
6+
7+
The [compiler internals documentation](https://seq-lang.org/internals.html) is probably a good starting point if you plan on modifying the compiler. If you have any specific questions, please don't hesitate to ask on Gitter.
8+
9+
## Development workflow
10+
11+
All development is done on the [`develop`](https://github.com/seq-lang/seq/tree/develop) branch. Just before release, we bump the version number, merge into [`master`](https://github.com/seq-lang/seq/tree/master) and tag the build with a tag of the form `vX.Y.Z` where `X`, `Y` and `Z` are the [SemVer](https://semver.org) major, minor and patch numbers, respectively. Our Travis CI build script automatically builds and deploys tagged commits as a new GitHub release via our trusty [@SeqBot](https://github.com/seqbot). It also builds and deploys the documentation to our website.
12+
13+
## Coding standards
14+
15+
- All C++ code should be formatted with [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) using the LLVM style guide.
16+
- All OCaml code should be formatted with [OCamlFormat](https://github.com/ocaml-ppx/ocamlformat) using the Jane Street style guide.
17+
18+
## Writing tests
19+
20+
Tests are written as Seq programs. The [`test/core/`](https://github.com/seq-lang/seq/tree/master/test/core) directory contains some examples. If you add a new test file, be sure to add it to [`test/main.cpp`](https://github.com/seq-lang/seq/blob/master/test/main.cpp) so that it will be executed as part of the test suite. There are two ways to write tests for Seq:
21+
22+
#### New style
23+
24+
Example:
25+
26+
```python
27+
@test
28+
def my_test():
29+
assert 2 + 2 == 4
30+
my_test()
31+
```
32+
33+
**Semantics:** `assert` statements in functions marked `@test` are not compiled to standard assertions: they don't terminate the program when the condition fails, but instead print source information, fail the test, and move on.
34+
35+
#### Old style
36+
37+
Example:
38+
39+
```python
40+
print 2 + 2 # EXPECT: 4
41+
```
42+
43+
**Semantics:** The source file is scanned for `EXPECT`s, executed, then the output is compared to the "expected" output. Note that if you have, for example, an `EXPECT` in a loop, you will need to duplicate it however many times the loop is executed. Using `EXPECT` is helpful mainly in cases where you need to test control flow, **otherwise prefer the new style**.
44+
45+
## Pull requests
46+
47+
Pull requests should generally be based on the `develop` branch. Before submitting a pull request, pleace make sure...
48+
49+
- ... to provide a clear description of the purpose of the pull request.
50+
- ... to include tests for any new or changed code.
51+
- ... that all code is formatted as per the guidelines above.
52+
53+
Please be patient with pull request reviews, as our throughput is limited!
54+
55+
## Issues
56+
57+
We use [GitHub's issue tracker](https://github.com/seq-lang/seq/issues), so that's where you'll find the most recent list of open bugs, feature requests and general issues. If applicable, we try to tag each issue with at least one of the following tags:
58+
59+
- `Build`: Issues related to building Seq
60+
- `Codegen`: Issues related to code generation (i.e. after parsing and type checking)
61+
- `Parser`: Issues related to lexing/parsing
62+
- `Library`: Issues related to the Seq standard library
63+
- `Interop`: Issues related to interoperability with other languages or systems
64+
- `Docs`: Issues related to documentation
65+
- `Feature`: New language feature proposals

compiler/include/seq/seq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#define SEQ_VERSION_MAJOR 0
3737
#define SEQ_VERSION_MINOR 9
38-
#define SEQ_VERSION_PATCH 3
38+
#define SEQ_VERSION_PATCH 4
3939

4040
namespace seq {
4141
namespace types {

compiler/lang/func.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ void Func::sawPrefetch(Prefetch *prefetch) {
229229
throw exc::SeqException(
230230
"function cannot perform both prefetch and inter-sequence alignment",
231231
getSrcInfo());
232+
if (this->prefetch)
233+
return;
234+
232235
this->prefetch = true;
233236
gen = true;
234237
outType = types::GenType::get(outType, types::GenType::GenTypeKind::PREFETCH);

compiler/lang/lang.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ void TryCatch::codegen0(BasicBlock *&block) {
530530
BasicBlock *preambleBlock = base->getPreamble();
531531
types::Type *retType = base->getFuncType()->getBaseType(0);
532532

533+
if (types::GenType *gen = retType->asGen()) {
534+
if (gen->fromPrefetch() || gen->fromInterAlign())
535+
retType = gen->getBaseType(0);
536+
}
537+
533538
// entry block:
534539
BasicBlock *entryBlock = BasicBlock::Create(context, "entry", func);
535540
BasicBlock *entryBlock0 = entryBlock;

compiler/lang/pipeline.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ static Value *codegenPipe(BaseFunc *base,
364364
assert(!inParallel);
365365

366366
BasicBlock *notFull = BasicBlock::Create(context, "not_full", func);
367+
BasicBlock *notFull0 = notFull;
367368
BasicBlock *full = BasicBlock::Create(context, "full", func);
368369
BasicBlock *exit = BasicBlock::Create(context, "exit", func);
369370

@@ -396,8 +397,8 @@ static Value *codegenPipe(BaseFunc *base,
396397
BasicBlock *preamble = base->getPreamble();
397398
// construct parameters
398399
types::GenType::InterAlignParams paramExprs = genType->getAlignParams();
399-
Value *params = PipeExpr::validateAndCodegenInterAlignParams(
400-
paramExprs, base, preamble);
400+
Value *params =
401+
PipeExpr::validateAndCodegenInterAlignParams(paramExprs, base, entry);
401402

402403
IRBuilder<> builder(preamble);
403404
const unsigned W = PipeExpr::SCHED_WIDTH_INTERALIGN;
@@ -431,14 +432,14 @@ static Value *codegenPipe(BaseFunc *base,
431432
Value *N = builder.CreateLoad(filled);
432433
Value *M = ConstantInt::get(seqIntLLVM(context), W);
433434
Value *cond = builder.CreateICmpSLT(N, M);
434-
builder.CreateCondBr(cond, notFull, full);
435+
builder.CreateCondBr(cond, notFull0, full);
435436

436437
builder.SetInsertPoint(full);
437438
N = builder.CreateCall(flush, {pairs, bufRef, bufQer, states, N, params,
438439
hist, pairsTemp, statesTemp});
439440
builder.CreateStore(N, filled);
440441
cond = builder.CreateICmpSLT(N, M);
441-
builder.CreateCondBr(cond, notFull, full); // keep flushing while full
442+
builder.CreateCondBr(cond, notFull0, full); // keep flushing while full
442443

443444
// store the current state for the drain step:
444445
drain->states = states;

compiler/types/ptr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ void types::PtrType::initOps() {
5252
},
5353
false},
5454

55+
{"__int__",
56+
{},
57+
Int,
58+
[](Value *self, std::vector<Value *> args, IRBuilder<> &b) {
59+
return b.CreatePtrToInt(self, seqIntLLVM(b.getContext()));
60+
},
61+
false},
62+
5563
{"__copy__",
5664
{},
5765
this,

docs/sphinx/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setup(sphinx):
3030
# The short X.Y version
3131
version = u'0.9'
3232
# The full version, including alpha/beta/rc tags
33-
release = u'0.9.3'
33+
release = u'0.9.4'
3434

3535
# Logo path
3636
html_logo = '../images/logo.png'

docs/sphinx/cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Parallel FASTQ processing
196196
197197
# Sometimes batching reads into blocks can improve performance,
198198
# especially if each is quick to process.
199-
FASTQ('reads.fq') |> iter |> block(1000) ||> process
199+
FASTQ('reads.fq') |> blocks(size=1000) ||> iter |> process
200200
201201
Reading SAM/BAM/CRAM
202202
--------------------

docs/sphinx/index.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,26 @@ Source code is available `on GitHub <https://github.com/seq-lang/seq>`_. You can
1616
build
1717
internals
1818
api/doxygen
19+
20+
Frequently Asked Questions
21+
--------------------------
22+
23+
*What is the goal of Seq?*
24+
25+
One of the main focuses of Seq is to bridge the gap between usability and performance in the fields of bioinformatics and computational genomics, which have an unfortunate reputation for hard-to-use, buggy or generally poorly-written software. Seq aims to make writing high-performance genomics or bioinformatics software substantially easier, and to provide a common, unified framework for the development of such software.
26+
27+
*Why do we need a whole new language? Why not a library?*
28+
29+
There are many great bioinformatics libraries on the market today, including `Biopython <https://biopython.org>`_ for Python, `SeqAn <https://www.seqan.de>`_ for C++ and `BioJulia <https://biojulia.net>`_ for Julia. In fact, Seq offers a lot of the same functionality found in these libraries. The advantages of having a domain-specific language and compiler, however, are the higher-level constructs and optimizations like :ref:`pipeline`, :ref:`match`, :ref:`interalign` and :ref:`prefetch`, which are difficult to replicate in a library, as they often involve large-scale program transformations/optimizations. A domain-specific language also allows us to explore different backends like GPU, TPU or FPGA in a systematic way, in conjunction with these various constructs/optimizations, which is ongoing work.
30+
31+
*What about interoperability with other languages and frameworks?*
32+
33+
Interoperability is and will continue to be a priority for the Seq project. We don't want using Seq to render you unable to use all the other great frameworks and libraries that exist. Seq already supports interoperability with C/C++ and Python (see :ref:`interop`), which we are in the process of expanding (e.g. by allowing Python libraries to be written in Seq).
34+
35+
*I want to contribute! How do I get started?*
36+
37+
Great! Check out our `contribution guidelines <https://github.com/seq-lang/seq/blob/master/CONTRIBUTING.md>`_ and `open issues <https://github.com/seq-lang/seq/issues>`_ to get started. Also don't hesitate to drop by our `Gitter chatroom <https://gitter.im/seq-lang/Seq?utm_source=share-link&utm_medium=link&utm_campaign=share-link>`_ if you have any questions.
38+
39+
*What is planned for the future?*
40+
41+
See the `roadmap <https://github.com/seq-lang/seq/wiki/Roadmap>`_ for information about this.

docs/sphinx/intro.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Pre-built binaries for Linux and macOS on x86_64 are available alongside `each r
1515
1616
This will install Seq in a new ``.seq`` directory within your home directory. Be sure to update ``~/.bash_profile`` as the script indicates afterwards!
1717

18+
Seq binaries require a `libomp <https://openmp.llvm.org>`_ to be present on your machine. ``brew install libomp`` or ``apt install libomp5`` should do the trick.
19+
1820
Building from source
1921
^^^^^^^^^^^^^^^^^^^^
2022

@@ -35,8 +37,8 @@ or produce an LLVM bitcode file if a ``-o <out.bc>`` argument is provided. In th
3537
3638
seqc -o myprogram.bc myprogram.seq
3739
llc myprogram.bc -filetype=obj -o myprogram.o
38-
g++ -L/path/to/libseqrt/ -lseqrt -o myprogram myprogram.o
40+
gcc -L/path/to/libseqrt/ -lseqrt -lomp -o myprogram myprogram.o
3941
40-
This produces a ``myprogram`` executable. (If multithreading is needed, the ``g++`` invocation should also include ``-fopenmp``.)
42+
This produces a ``myprogram`` executable.
4143

4244
**Interfacing with C:** If a Seq program uses C functions from a particular library, that library can be specified via a ``-L/path/to/lib`` argument to ``seqc``. Otherwise it can be linked during the linking stage if producing an executable.

0 commit comments

Comments
 (0)