From the grammatical point of view, it is correct to use clause as a subject within sentence ?
*I have done that task * made him upset.
I was very tired- made him surprised.
Yes, it is possible to employ a clause, finite or nonfinite, as the subject of the sentence, and in this case it would be called Subject Clause.
That I have done that task made him upset.
Here That I have done that task functions as the subject clause and it is a finite clause.
Similarly, the second example contains a finite clause either, acting as the subject clause in the sentence:
That I was very tired made him surprised.
If it were:
To do that task made him upset.
Then a to infinitive clause would function as the subject clause in the sentence.
Or if it were:
Being very tired, made him upset.
Then a -ing clause would function as the subject clause in the sentence.