Large machine like clocks which tell the time was invented.
If I want which refer to large machine, will I need to add comma before which ?
I think that should be "large machines." About the use of comma before the relative pronoun "which," the rule is that if the relative clause is not necessary and is just giving more information about the noun, the comma must precede it; otherwise, the comma must not precede it. Consider the following examples:
Les Misérables, which was first published in 1862, is a great novel.
The book which I was reading last night was very interesting
In the first sentence, the book Les Misérables is completely known; therefore, the clause after it is not necessary, but we have used it to give extra information about the the book; thus, you should put a comma before it.
On the other hand, in the second sentence, the listener does not know which book the speaker is talking about, so the comma must not precede it.